![]() |
last non-empthy cell
hi, i need to "tell" the macro to move the coursor to the first empthy cell
in a coloumn, how to do that? thanks, dov |
last non-empthy cell
Dim rng as Range
on Error resume Next set rng = columns(3).SpecialCells(xlBlanks)(1) On Error goto 0 if rng is nothing then set rng = cells(rows.count,1).End(xlup) End if msgbox "Next empty cell is " & rng.Address -- Regards, Tom Ogilvy "dov" wrote in message ... hi, i need to "tell" the macro to move the coursor to the first empthy cell in a coloumn, how to do that? thanks, dov |
last non-empthy cell
Dov,
To simply select the cell: ActiveSheet.Range("A" & ActiveSheet.Rows.Count).End (xlUp).Offset(1,0).Select Or, to get the row number: Dim lRow as Long lRow = ActiveSheet.Range("A" & ActiveSheet.Rows.Count).End (xlUp).Row + 1 Range("A" & lRow).Value = "Next Cell" Cheers, Dave -----Original Message----- hi, i need to "tell" the macro to move the coursor to the first empthy cell in a coloumn, how to do that? thanks, dov . |
last non-empthy cell
Perhaps this function will do:
lastrow = lastcell(worksheetname) Cells(lastcell, colnum).Select Function lastcell(wsname) Sheets(wsname).Select lastcell = Application.WorksheetFunction.CountA(Columns("A:A" )) End Function Hi, Stefi €ždov€ť ezt Ă*rta: hi, i need to "tell" the macro to move the coursor to the first empthy cell in a coloumn, how to do that? thanks, dov |
last non-empthy cell
Need another line:
Dim rng as Range on Error resume Next set rng = columns(3).SpecialCells(xlBlanks)(1) On Error goto 0 if rng is nothing then set rng = cells(rows.count,1).End(xlup) End if if not isempty(rng) then set rng = rng.offset(1,0) msgbox "Next empty cell is " & rng.Address -- Regards, Tom Ogilvy "Tom Ogilvy" wrote in message ... Dim rng as Range on Error resume Next set rng = columns(3).SpecialCells(xlBlanks)(1) On Error goto 0 if rng is nothing then set rng = cells(rows.count,1).End(xlup) End if msgbox "Next empty cell is " & rng.Address -- Regards, Tom Ogilvy "dov" wrote in message ... hi, i need to "tell" the macro to move the coursor to the first empthy cell in a coloumn, how to do that? thanks, dov |
All times are GMT +1. The time now is 07:21 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com