ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   A simple copy problem (https://www.excelbanter.com/excel-programming/323492-simple-copy-problem.html)

Tim Coddington

A simple copy problem
 
I need to copy a column of cells from one sheet to another. Like ...
Private Sub trycopy()
Worksheets("Sheet1").Range("E1:E17").Copy Destination:=ActiveCell
End Sub
The problem is, I only know the column number, not the letter. E = 5.
How can I do the copy using the column number, or alter the number to a
letter?



Tom Ogilvy

A simple copy problem
 
Private Sub trycopy()
col = 5
Worksheets("Sheet1").cells(1,col).Resize(17,1).Cop y _
Destination:=ActiveCell
End Sub

--
Regards,
Tom Ogilvy

"Tim Coddington" wrote in message
...
I need to copy a column of cells from one sheet to another. Like ...
Private Sub trycopy()
Worksheets("Sheet1").Range("E1:E17").Copy Destination:=ActiveCell
End Sub
The problem is, I only know the column number, not the letter. E = 5.
How can I do the copy using the column number, or alter the number to a
letter?





Tim Coddington

A simple copy problem - Thanks Tom!
 
Thanks Tom! Have never used .Resize. This will help in lots of ways!
"Tom Ogilvy" wrote in message
...
Private Sub trycopy()
col = 5
Worksheets("Sheet1").cells(1,col).Resize(17,1).Cop y _
Destination:=ActiveCell
End Sub

--
Regards,
Tom Ogilvy

"Tim Coddington" wrote in message
...
I need to copy a column of cells from one sheet to another. Like ...
Private Sub trycopy()
Worksheets("Sheet1").Range("E1:E17").Copy Destination:=ActiveCell
End Sub
The problem is, I only know the column number, not the letter. E = 5.
How can I do the copy using the column number, or alter the number to a
letter?








All times are GMT +1. The time now is 12:28 PM.

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