View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Toppers Toppers is offline
external usenet poster
 
Posts: 4,339
Default About going through all the cells in a sheet....

Marko
Hope this helps:

Sub a()
Dim Lastcol As Integer, Lastrow As Long
' Last non-blank column in row 1
' If columns A,B have data, C is blank, D has data then Lastcol=4 i.e.
Column D
Lastcol = Cells(1, Columns.Count).End(xlToLeft).Column
'last row in column 1 .. last non-blank column starting from bottom of column
Lastrow = Cells(Rows.Count, 1).End(xlUp).Row
' data in K15
Range("k15") = 1234
' cells(row,column)
Cells(15, "K") = 1234
Cells(15, 11) = 1234
End Sub

"marko" wrote:

Hi!
I'm a newbie in excel but I'm learning and i would apriciate if someone
would help me.
I know something from the VB code because i work a little bit in VB .NET so
i just need some instructions for the VB references (my english is bad, so i
don't know which word to use) for excel.

First:
In the first row I would like to determine which cell is the last with any
data(but only the first row, row 1).
And in the first column I would like to determine which row is the last
with any data(but only the first column, column A)

Second:
How do i position myself in a cell? Let's say cell K15.

Thanks to everyone who is willing to help!

Marko Svaco