Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
search and replace question
can someone explain why this code works with or without the for and next
lines? if i take out the for and next lines, it still apears to do the search and replace on all lines in the worksheet thanks ------------------------------------------------- Application.ScreenUpdating = False For x = LastRow To 1 Step -1 Cells.Replace What:=""" """, Replacement:=",", LookAt:=xlPart, _ SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _ ReplaceFormat:=False Cells.Replace What:="""", Replacement:="", LookAt:=xlPart, SearchOrder _ :=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False Next x Columns("A:A").Select Selection.TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _ TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _ Semicolon:=False, Comma:=True, Space:=False, Other:=False, FieldInfo _ :=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1)), _ TrailingMinusNumbers:=True Range("A1").Select Columns("A:E").EntireColumn.AutoFit Application.ScreenUpdating = True -- Gary |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
search and replace question
The statement Cells.Replace will affect all rows as 'Cells' without any parameters refers to al cells on the worksheet. If you want to limit the rows for the replace you could try Range( Cells(1,1), Cells( LastRow, 1 ) ).EntireRow.Replace The parameters of the Cell statement above relate to Row and Column. Hope that helps -- humeja ----------------------------------------------------------------------- humejap's Profile: http://www.excelforum.com/member.php...nfo&userid=550 View this thread: http://www.excelforum.com/showthread.php?threadid=39936 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
search and replace question
thanks for the explanation. i really don't need to change anything, as long
as it works, i was just curious why i didn't need the for/next statements. -- Gary "humejap" wrote in message ... The statement Cells.Replace will affect all rows as 'Cells' without any parameters refers to all cells on the worksheet. If you want to limit the rows for the replace you could try Range( Cells(1,1), Cells( LastRow, 1 ) ).EntireRow.Replace The parameters of the Cell statement above relate to Row and Column. Hope that helps. -- humejap ------------------------------------------------------------------------ humejap's Profile: http://www.excelforum.com/member.php...fo&userid=5506 View this thread: http://www.excelforum.com/showthread...hreadid=399368 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Search and Replace | New Users to Excel | |||
Search and Replace Question | New Users to Excel | |||
Simple Search and Replace Question | Excel Discussion (Misc queries) | |||
Search and Replace... | Excel Programming | |||
Macro search replace question | Excel Programming |