Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
I would like a macro that will find the first empty line under col A: I would also like that macro to activate as soon as the Excel file is opened. Thanks Ian M |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
pcorcele wrote:
I would like a macro that will find the first empty line under col A: I would also like that macro to activate as soon as the Excel file is opened. Depends on what you mean by "first empty line". If you mean "the line under the bottom used row", put this in the workbook's ThisWorkbook object: Private Sub Workbook_Open() Cells(Cells.SpecialCells(xlCellTypeLastCell).Row + 1, 1).Select End Sub If you mean "the first line that happens to have nothing in it", use this instead: Private Sub Workbook_Open() For x = 1 To Cells.SpecialCells(xlCellTypeLastCell).Row For y = 1 To Cells.SpecialCells(xlCellTypeLastCell).Column If Len(Cells(x, y).Formula) Then GoTo notEmpty Next 'this is what we want Cells(x, 1).Select Exit Sub notEmpty: Next Cells(Cells.SpecialCells(xlCellTypeLastCell).Row + 1, 1).Select End Sub If you mean *anything else*, you'll need to clarify. -- I think we've found Satan's toilet. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try...
Cells(Rows.Count, 1).End(xlUp)(2).Select ...in Workbook_Open event or Auto_Open sub. Note that this will select A2 if colA is empty. Otherwise, if A19 is the last non-empty cell in colA then A20 will be selected. If you want the first empty cell in colA below the first row... Cells(1,1).End(xldown)(2).Select ...which assumes A1 is not empty, but there are some blank cells between A1 and the last non-empty row in colA. -- Garry Free usenet access at http://www.eternal-september.org Classic VB Users Regroup! comp.lang.basic.visual.misc microsoft.public.vb.general.discussion |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro required | Excel Worksheet Functions | |||
Pilgrim needs help: Effecting keystroks required by a macro nested within a macro. | Excel Programming | |||
Macro help required | Excel Programming | |||
vba macro required ? | Links and Linking in Excel | |||
Macro help required! | Excel Programming |