View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default Last Row in Column not working

I don't see where xlSheet is defined. If "xlSheet" is the name of a specific
worksheet (tab name) then:

Sub ordinate()
Dim ws As Worksheet
Set ws = Sheets("xlSheet")
MsgBox (ws.Cells(Rows.Count, "A").End(xlUp).Row)
MsgBox (ws.Cells(Rows.Count, 1).End(xlUp).Row)
End Sub

--
Gary''s Student - gsnu200747


"Terry" wrote:

OK, I am stuck. I have this line of code that was working:

Doesn't work
lnglastrow = xlSheet.Cells(xlSheet.Rows.Count, "A").End(xlUp).Row

Does work
lnglastrow = xlSheet.Cells(xlSheet.Rows.Count, 1).End(xlUp).Row

Now it only works if I replace the "A" with a 1. This is happening
throughout my code where I do not use a column number. Anyone have any
suggestions?

thanks

Terry