Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / March 2007

Tip: Looking for answers? Try searching our database.

Macro required to copy -past data to first empty row

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Vikky - 21 Mar 2007 18:37 GMT
Hi Expert,

I am in need of such a macro or code by which I can copy & paste data
from a particular row to first empty row of given row range.

Kindly help.

Regards,
Vikky
Ron de Bruin - 21 Mar 2007 18:44 GMT
Hi Vikky

See
http://www.rondebruin.nl/copy1.htm

Or if you want to find the row number of the last cell with data in a range see
http://www.rondebruin.nl/last.htm

Signature

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm

> Hi Expert,
>
[quoted text clipped - 5 lines]
> Regards,
> Vikky
Vikky - 21 Mar 2007 19:17 GMT
> Hi Vikky
>
[quoted text clipped - 17 lines]
>
> - Show quoted text -

Hi Ron,

Thanks for ur reply.

I have visited both url which you have mentioned beinf a novice to
macro & codes i'm fail to understand how to reach to desired result.

Kindly help.

Regards,

Vikky
Ron de Bruin - 21 Mar 2007 19:25 GMT
Hi Vikky

Give more information

Do you want to copy a row (fixed row or selected row ?) to another sheet or in the same sheet below other data ?

Signature

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm

>> Hi Vikky
>>
[quoted text clipped - 30 lines]
>
> Vikky
Vikky - 21 Mar 2007 19:43 GMT
> Hi Vikky
>
[quoted text clipped - 42 lines]
>
> - Show quoted text -

Hi Ron,

Yes, I want to copy a fixed row  to in the same sheet below other
data.

Regards,

Vikky
Ron de Bruin - 21 Mar 2007 19:56 GMT
Copy the macro and function in a normal module
Alt F11
Insert module
Paste it in the module
Alt q to go back to Excel

This example copy row 1 from the sheet "Sheet1" to the first empty row on the worksheet "Sheet1"
You can run the macro with Alt-F8 or add a button on your sheet to run the macro

Sub copy_3_Values_PasteSpecial()
   Dim sourceRange As Range
   Dim destrange As Range
   Dim Lr As Long
   Application.ScreenUpdating = False
   Lr = LastRow(Sheets("Sheet1")) + 1
   Set sourceRange = Sheets("Sheet1").Rows("1:1")
   Set destrange = Sheets("Sheet1").Rows(Lr)
   sourceRange.Copy
   destrange.PasteSpecial xlPasteValues, , False, False
   Application.CutCopyMode = False
   Application.ScreenUpdating = True
End Sub

Function LastRow(sh As Worksheet)
   On Error Resume Next
   LastRow = sh.Cells.Find(What:="*", _
                           After:=sh.Range("A1"), _
                           Lookat:=xlPart, _
                           LookIn:=xlFormulas, _
                           SearchOrder:=xlByRows, _
                           SearchDirection:=xlPrevious, _
                           MatchCase:=False).Row
   On Error GoTo 0
End Function

Signature

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm

>> Hi Vikky
>>
[quoted text clipped - 51 lines]
>
> Vikky
Vikky - 21 Mar 2007 20:31 GMT
> Copy the macro and function in a normal module
> Alt F11
[quoted text clipped - 92 lines]
>
> - Show quoted text -

Hi Ron,

It's Working.:)

Thanks Alot for ur great help. This would save a lot of time of mine.

Once again thanks a lot.

Regards,

Vikky
Ron de Bruin - 21 Mar 2007 20:39 GMT
You are welcome

Signature

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm

>> Copy the macro and function in a normal module
>> Alt F11
[quoted text clipped - 104 lines]
>
> Vikky
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.