MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Skipping X Number of Columns


Posted by Brian S. on January 15, 2002 5:51 AM

I have a sheet and the data that I need starts at column K. I then need to move 2 columns (L,M), then insert 3 new columns. This pattern will go on until my last data set is reached(AI). Not quite sure how to properly refernce the columns in VB (especially those past Z!) Any help is appereciated!

Thanks,
Brian


Posted by christopher on January 15, 2002 7:22 AM

when i've done this before i use the following method which is slightly cheesy but it works


alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

string1 = mid(alpha,int(counter/26),1) ' how many 26s
string2 = mid(alpha,counter - int(counter/26)*26,1) ' the remainder

string3 =string1&string2 ' concatenate

columns(string3).insert ' insert the column

Posted by Brian on January 15, 2002 12:28 PM