Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Reference a Column in Code
below is a put together of a sub that I am trying to
accomplish where I will look at the top cell in a column and if it meets the criteria, then I want it to copy that column onto another worksheet to the first open column but not sure how to reference columns in the code. When I leave it as below with Columns ("A:A") it works fine, but I need ("A:A") to equal colnum or something like that, but when I try Columns ("colnum:colnum") it does not work and I have tried it without the quotes as well. Any assistance would be appreciated. What the real question is, is how to reference a column in code, I can get it to work for Row, column but not sure how to get it to work for the entire column. Code below is a slopy example. Thanks in advance Wally Steadman Sub one() dim colct as VARIANT dim colnum as (INTEGER or VARIANT) colct = 1 Columns("G:G").Select Selection.copy Sheets("Sheet2").Select Columns("A:A").Select ActiveSheet.Paste End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Use text from a cell reference in vba code. | Excel Discussion (Misc queries) | |||
Naming a reference table for use in a VBA Code | Excel Discussion (Misc queries) | |||
Row reference increment but preserve column reference | Excel Worksheet Functions | |||
Macro to Reference Column Next to Current Reference | Excel Discussion (Misc queries) | |||
Adding reference in code | Excel Programming |