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
 

Some videos you may like

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
L

Legacy 98055

Guest
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
 

cgriff

Board Regular
Joined
Aug 26, 2002
Messages
201
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
 
L

Legacy 98055

Guest
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
 

cgriff

Board Regular
Joined
Aug 26, 2002
Messages
201

ADVERTISEMENT

hi tom
it will cause me problems do you have a work around

many thanks
cgriff
 

cgriff

Board Regular
Joined
Aug 26, 2002
Messages
201
hi tom
it will cause me problems do you have a work around

many thanks
cgriff
 

cgriff

Board Regular
Joined
Aug 26, 2002
Messages
201
hi tom

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

Watch MrExcel Video

Forum statistics

Threads
1,123,318
Messages
5,600,917
Members
414,416
Latest member
Nobu

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
Top