Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
One way is to look at the top cell. then the second, then slide down to the
bottom if both are non-empty: Option Explicit Sub testme() Dim DestCell As Range Dim iCol As Long iCol = 6 With Worksheets("sheet1") If IsEmpty(.Cells(1, iCol)) Then Set DestCell = .Cells(1, iCol) ElseIf IsEmpty(.Cells(2, iCol)) Then Set DestCell = .Cells(2, iCol) Else Set DestCell = .Cells(1, iCol).End(xlDown).Offset(1, 0) End If End With DestCell.Select End Sub I used iCol = 6 (column F) in my example. dov wrote: 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 -- Dave Peterson |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 . |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I calculate a weighted average and exclude the empthy cells | Excel Worksheet Functions | |||
Code to copy the formulae of one cell to all the cell in the rangewith the specific cell and columnnumber changing Options | Excel Discussion (Misc queries) | |||
Code to copy the formulae of one cell to all the cell in the rangewith the specific cell and columnnumber changing | Excel Discussion (Misc queries) | |||
Populate a cell if values in cell 1 and cell 2 match cell 3 and 4 | Excel Worksheet Functions | |||
How to create/run "cell A equals Cell B put Cell C info in Cell D | Excel Discussion (Misc queries) |