Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi Everyone, I would like to ask 1

Status
Not open for further replies.

Ranf

Technical User
May 1, 2003
6
IL
Hi Everyone,

I would like to ask something which I guess is basic for many of you, but I'll ask anyway, just because I don't know the answer myself..
Here it is:
Basicly I would like to know which command can I use in order to choose a cell with i,j (- integers) when i stands for the column *number* (1 for A 2 for B etc) and j for the Row)

Could you please print a code which uses a double "for" loop with i and j as its indexes which insert "1" for cells A1:C3 (square), one cell at a time.
This will allow me to use the code in my original program.

Thanks so much,
Ran
 
Hi,
Here's the code to process the cells in the range A1:C3...
Code:
    Dim iCol As Integer, lRow As Long
    With Range("A1:C3")
       For lRow = .Row To .Rows.Count + .Row - 1
          For iCol = .Column To .Columns.Count + .Column - 1
             With Cells(lRow, iCol)
             'do stuff with this cell...
                .Value = "X"
             End With
          Next iCol
       Next lRow
    End With
You can substitute any range and this should work.

Hope this helps :)

Skip,
Skip@TheOfficeExperts.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top