LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Looping Maggie[_6_] Excel Discussion (Misc queries) 6 October 2nd 08 09:14 PM
Looping anderssweden Excel Programming 1 June 14th 06 03:00 PM
Next For looping in a If Jean-Jerome Doucet via OfficeKB.com Excel Programming 7 July 12th 05 07:46 PM
Looping [email protected] Excel Programming 0 October 31st 03 07:47 PM
Looping Stuart[_9_] Excel Programming 0 October 29th 03 11:31 PM


All times are GMT +1. The time now is 09:00 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"