Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Everyday, I get a file that has several rows and columns with data. I
wanted to build a macro that can locate first row after the data that has no values in any cells. Then, i want to select thar row (lets say row 105) and select it till the last row i.e. 65536 or so. And then delete those. (yes, although it doens't have any values, i still need to delete those once) Please help. I think there should be some loop function that can locate the row that has no values. Then select it up to 65000th row and delete those. It's really getting hard to figure it out. Thanks |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
try the below
LastRow = Range("A1").End(xlDown).Row LastRow is type Long, change the start point from A2 to your data start point -- Tony Green "VB Script for Excel" wrote: Everyday, I get a file that has several rows and columns with data. I wanted to build a macro that can locate first row after the data that has no values in any cells. Then, i want to select thar row (lets say row 105) and select it till the last row i.e. 65536 or so. And then delete those. (yes, although it doens't have any values, i still need to delete those once) Please help. I think there should be some loop function that can locate the row that has no values. Then select it up to 65000th row and delete those. It's really getting hard to figure it out. Thanks |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub Delete_Past_LastCell()
Dim RealLastRow As Long Dim RealLastColumn As Long On Error Resume Next RealLastRow = _ Cells.Find("*", Range("A1"), , , xlByRows, xlPrevious).Row RealLastColumn = _ Cells.Find("*", Range("A1"), , , xlByColumns, xlPrevious).Column set rng = Cells(RealLastRow, RealLastColumn).Offset(1,0) range(rng,cells(rows.count,1)).EntireRow.Delete End Sub -- Regards, Tom Ogilvy "VB Script for Excel" wrote: Everyday, I get a file that has several rows and columns with data. I wanted to build a macro that can locate first row after the data that has no values in any cells. Then, i want to select thar row (lets say row 105) and select it till the last row i.e. 65536 or so. And then delete those. (yes, although it doens't have any values, i still need to delete those once) Please help. I think there should be some loop function that can locate the row that has no values. Then select it up to 65000th row and delete those. It's really getting hard to figure it out. Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Locating values in a range and bringing up the corresponding price | Excel Worksheet Functions | |||
locating and deleting duplicate cell entries | Excel Discussion (Misc queries) | |||
Locating and selecting Data from Worksheet | Excel Discussion (Misc queries) | |||
Help with locating values in cells and caluculating | Excel Worksheet Functions | |||
Dynamically locating value; selecting that row and everything above (or below) and deleting/copying | Excel Programming |