copy/paste

cgriff

Board Regular
Joined
Aug 26, 2002
Messages
201
can you help me with this macro
I pick data from sheet 1 and send it to sheet3
If I have blank rows in sheet 1 I dont want them in sheet3

Thanks in advance









Sub Macro1()
'
' Macro1 Macro
' Macro recorded 27/8/2002 by mb
'

'Sub CopySheet1ToSheet3()
Dim wbBook As Workbook
Dim wsSheet1 As Worksheet, wsSheet3 As Worksheet
Dim rnSource As Range, rnTarget As Range

Set wbBook = ThisWorkbook
Set wsSheet1 = wbBook.Worksheets("Sheet1")
Set wsSheet3 = wbBook.Worksheets("Sheet3")

With wsSheet1
Set rnSource = .Range("A1:h20")
End With

With wsSheet3
Set rnTarget = .Range("A65536").End(xlUp).Offset(1, 0)
End With

rnSource.Copy rnTarget

End Sub
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
This may or may not be a complete solution for you. Append your code as follows.
<pre>
With wsSheet1
Set rnSource = .Range("A1:h20")
Set rnSource = rnSource.SpecialCells(xlCellTypeConstants)
End With

</pre>
Tom
 
Upvote 0
Tom I got it to work the only problem is if I have a gap with data across
This message was edited by cgriff on 2002-10-13 06:18
 
Upvote 0
Yeah cg.
I should have been clear. The may or may not part of my previous reply depended on how your range was filled with data.
Easy to work around if it causes you any problems.
Tom
 
Upvote 0
hi tom

Is it possible to help with above
This message was edited by cgriff on 2002-11-28 14:58
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,215
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top