Column numbering instead of letters


G

grahammal

In the following visual basic entry I have selected cell "D8" on
Sheet1.
Sheets("Sheet1").Select
Range("D8").Select
If my columns are numbered, how do I reference this cell.
It was column D row 8 but is now column 4 row 8.
I need this information to run a program with some For.... Next loops.
 
Ad

Advertisements

D

dominicb

Good afternoon grahammal

Why not just change it back.
Go to Tools > Options, General, Settings and uncheck the R1C1 Reference
Style box.

HTH

DominicB
 
G

grahammal

Because I want to increment the colomns in a For.....Next loop
 
D

dominicb

Hi Graham

You don't have to change your column titles to increment the cells.
Does the code below help. This will place an incrementing number i
each cell in row 1 using a For ... Next loop.

Sub Test()
Range("A1").Select
For n = 1 To 255
ActiveCell.Offset(, n).Value = n
Next n
End Sub

HTH

Dominic
 
G

grahammal

Your a diamond, thats exactly what I was looking for.
Cheers
 
Ad

Advertisements

Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top