Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Letter alternative to 1 - 26
I have used the code;
Dim i as integer For i = 1 to 26 a lot to refer to sheets and rows numbered consequtively. However I am writing code with the lines below; ActiveCell.Offset(1, 1) = Sheets("drivers").Range("a1") ActiveCell.Offset(1, 1) = Sheets("drivers").Range("b1") ActiveCell.Offset(1, 1) = Sheets("drivers").Range("c1") ActiveCell.Offset(1, 1) = Sheets("drivers").Range("d1") And i wondered if there was a way to do a similar thing in this code with the column letters. I guess it will be a way of referring to the column instead of having the above code for 35 lines referring to each column individually. Can anyone suggest the way to but a Next in this code so I can shorten my macro considerably? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Letter alternative to 1 - 26
Hi
Dim i As Integer For i = 1 To 26 ActiveCell.Offset(0, i) = Sheets("drivers").Cells(1, i) Next -- Regards Roger Govier "keri" wrote in message oups.com... I have used the code; Dim i as integer For i = 1 to 26 a lot to refer to sheets and rows numbered consequtively. However I am writing code with the lines below; ActiveCell.Offset(1, 1) = Sheets("drivers").Range("a1") ActiveCell.Offset(1, 1) = Sheets("drivers").Range("b1") ActiveCell.Offset(1, 1) = Sheets("drivers").Range("c1") ActiveCell.Offset(1, 1) = Sheets("drivers").Range("d1") And i wondered if there was a way to do a similar thing in this code with the column letters. I guess it will be a way of referring to the column instead of having the above code for 35 lines referring to each column individually. Can anyone suggest the way to but a Next in this code so I can shorten my macro considerably? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Adding a number to a letter of the alphabet to get a letter | Excel Worksheet Functions | |||
New Validation option to format 1st letter as Capital letter | Excel Discussion (Misc queries) | |||
Default Capital letter for 1st letter of a word | Excel Discussion (Misc queries) | |||
column header changed from letter to number, how return to letter | Excel Discussion (Misc queries) | |||
press letter and go 2 entry begin w letter in data validation drop | Excel Programming |