Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Looping through
I am tring to clean up a report that is pulled in a off a propritary program
in my company. The format comes in as all "General" cell format. I have cleaned up some stuff already but am having a hard time getting the below to work properly. I have three varibles I want need to look for (any text, "-" or a number) and do something based on what is active in a cell. From a specific starting point in the spreadsheet I need to find the first active cell to the right that contains a number. from there I want to select all cells between the starting point and the cell with the number and delete them. I want this to loop through the whole spreadsheet and should clean up the a garbage brought in from the other program. Sub step_Five() Columns("A:A").Select Selection.Find(What:="Part", After:=ActiveCell, LookIn:=xlFormulas, _ LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False).Activate ActiveCell.Offset(2, 1).Select ActiveCell.Name = "Part5" If ActiveCell.Text = "" Then Do ActiveCell.Offset(0, 1).Select Loop End If If ActiveCell.Text = "-" Then Do ActiveCell.Offset(1, 0).Select Loop End If If ActiveCell.Text = 0 Then Do ActiveCell.Offset(0,-1).Select ActiveCell.Name = "Part5a" Range("Part5:Part5a").Select Selection.Delete Shift:=xlToLeft "Delete Names out of cell?" ActiveCell.Offset(1, 0).Select Loop End If End Sub Anyone have a better way for this? Thanks Peter |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Looping | Excel Discussion (Misc queries) | |||
Looping | Excel Programming | |||
Next For looping in a If | Excel Programming | |||
Looping | Excel Programming | |||
Looping | Excel Programming |