ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to copy and paste in VB (https://www.excelbanter.com/excel-programming/349679-how-copy-paste-vbulletin.html)

AK

How to copy and paste in VB
 
If worksheet :
A B C
1 20051208 =LEFT(A1,6) 10000
2 20051209 5000
3 20051222 24200

I want to copy the formula from cells(B1) down to the last used cells(which
is unknown) , how to implement in VB. I try to use OFFSET but doesn't work.

Thanks for your help in advance

bpeltzer

How to copy and paste in VB
 
Range("B1").Select
Selection.Copy
Application.Goto Reference:="R65536C1"
Selection.End(xlUp).Select
Selection.Offset(0, 1).Select
Range(Selection, Selection.End(xlUp)).Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("B1").Select


"ak" wrote:

If worksheet :
A B C
1 20051208 =LEFT(A1,6) 10000
2 20051209 5000
3 20051222 24200

I want to copy the formula from cells(B1) down to the last used cells(which
is unknown) , how to implement in VB. I try to use OFFSET but doesn't work.

Thanks for your help in advance


voodooJoe

How to copy and paste in VB
 
try:

With Sheet1
.Range("b1").AutoFill
..Range("b1").Resize(rowsize:=.Range("a1").Current Region.Rows.Count),
xlFillCopy
End With

-voodooJoe

"bpeltzer" wrote in message
...
Range("B1").Select
Selection.Copy
Application.Goto Reference:="R65536C1"
Selection.End(xlUp).Select
Selection.Offset(0, 1).Select
Range(Selection, Selection.End(xlUp)).Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("B1").Select


"ak" wrote:

If worksheet :
A B C
1 20051208 =LEFT(A1,6) 10000
2 20051209 5000
3 20051222 24200

I want to copy the formula from cells(B1) down to the last used
cells(which
is unknown) , how to implement in VB. I try to use OFFSET but doesn't
work.

Thanks for your help in advance





All times are GMT +1. The time now is 10:04 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com