Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Delete
Recorded this macro, but I only want it to work in column C from row 6
downward. What do I need to add? Cells.Replace What:="O", Replacement:="", LookAt:=xlPart, SearchOrder:= _ xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceForm |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Delete
With activesheet
With .range("c6:c" & .rows.count) .cells.replace .... end with end with Did you really mean xlpart, not xlwhole? chrisnsmith wrote: Recorded this macro, but I only want it to work in column C from row 6 downward. What do I need to add? Cells.Replace What:="O", Replacement:="", LookAt:=xlPart, SearchOrder:= _ xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceForm -- Dave Peterson |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Delete
You need to first select the range then run the macro below;
Change from your macro = replaces Cells (which means all cells on the worksheet with Selection) If you do not want to select the range before running the macro then remove the ' before the line ' Range("F6:F50").Select and change 50 to whatever you want... Use Sub Macro1() ' Range("F6:F50").Select Selection.Replace What:="O", Replacement:="", LookAt:=xlPart, _ SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _ ReplaceFormat:=False End Sub "chrisnsmith" wrote: Recorded this macro, but I only want it to work in column C from row 6 downward. What do I need to add? Cells.Replace What:="O", Replacement:="", LookAt:=xlPart, SearchOrder:= _ xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceForm |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
Delete
That works if there are O's in column C, but I should have asked for
something that will function just as well when there are no O's in column C. Can you help? "Sheeloo" wrote: You need to first select the range then run the macro below; Change from your macro = replaces Cells (which means all cells on the worksheet with Selection) If you do not want to select the range before running the macro then remove the ' before the line ' Range("F6:F50").Select and change 50 to whatever you want... Use Sub Macro1() ' Range("F6:F50").Select Selection.Replace What:="O", Replacement:="", LookAt:=xlPart, _ SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _ ReplaceFormat:=False End Sub "chrisnsmith" wrote: Recorded this macro, but I only want it to work in column C from row 6 downward. What do I need to add? Cells.Replace What:="O", Replacement:="", LookAt:=xlPart, SearchOrder:= _ xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceForm |
#5
Posted to microsoft.public.excel.misc
|
|||
|
|||
Delete
Wouldn't a minor test tell you the answer faster than waiting for an answer?
chrisnsmith wrote: That works if there are O's in column C, but I should have asked for something that will function just as well when there are no O's in column C. Can you help? "Sheeloo" wrote: You need to first select the range then run the macro below; Change from your macro = replaces Cells (which means all cells on the worksheet with Selection) If you do not want to select the range before running the macro then remove the ' before the line ' Range("F6:F50").Select and change 50 to whatever you want... Use Sub Macro1() ' Range("F6:F50").Select Selection.Replace What:="O", Replacement:="", LookAt:=xlPart, _ SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _ ReplaceFormat:=False End Sub "chrisnsmith" wrote: Recorded this macro, but I only want it to work in column C from row 6 downward. What do I need to add? Cells.Replace What:="O", Replacement:="", LookAt:=xlPart, SearchOrder:= _ xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceForm -- Dave Peterson |
#6
Posted to microsoft.public.excel.misc
|
|||
|
|||
Delete
I'm not sure I understand what you mean. I did test the codes that both you
and Sheloo posted. I tried eliminating lines that I thought might be causing a problem when there were no O's in column C, but I'm a novice at this and am not sure what lines I should be eliminating. All I know is that when I try to run the code, and there are no O's to replace I get a highlight in the VB module. "Dave Peterson" wrote: Wouldn't a minor test tell you the answer faster than waiting for an answer? chrisnsmith wrote: That works if there are O's in column C, but I should have asked for something that will function just as well when there are no O's in column C. Can you help? "Sheeloo" wrote: You need to first select the range then run the macro below; Change from your macro = replaces Cells (which means all cells on the worksheet with Selection) If you do not want to select the range before running the macro then remove the ' before the line ' Range("F6:F50").Select and change 50 to whatever you want... Use Sub Macro1() ' Range("F6:F50").Select Selection.Replace What:="O", Replacement:="", LookAt:=xlPart, _ SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _ ReplaceFormat:=False End Sub "chrisnsmith" wrote: Recorded this macro, but I only want it to work in column C from row 6 downward. What do I need to add? Cells.Replace What:="O", Replacement:="", LookAt:=xlPart, SearchOrder:= _ xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceForm -- Dave Peterson |
#7
Posted to microsoft.public.excel.misc
|
|||
|
|||
Delete
Forget it. Used the replace command instead.
"Dave Peterson" wrote: With activesheet With .range("c6:c" & .rows.count) .cells.replace .... end with end with Did you really mean xlpart, not xlwhole? chrisnsmith wrote: Recorded this macro, but I only want it to work in column C from row 6 downward. What do I need to add? Cells.Replace What:="O", Replacement:="", LookAt:=xlPart, SearchOrder:= _ xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceForm -- Dave Peterson |
#8
Posted to microsoft.public.excel.misc
|
|||
|
|||
Delete
Share the snippet of code and indicate the line that causes the error.
chrisnsmith wrote: I'm not sure I understand what you mean. I did test the codes that both you and Sheloo posted. I tried eliminating lines that I thought might be causing a problem when there were no O's in column C, but I'm a novice at this and am not sure what lines I should be eliminating. All I know is that when I try to run the code, and there are no O's to replace I get a highlight in the VB module. "Dave Peterson" wrote: Wouldn't a minor test tell you the answer faster than waiting for an answer? chrisnsmith wrote: That works if there are O's in column C, but I should have asked for something that will function just as well when there are no O's in column C. Can you help? "Sheeloo" wrote: You need to first select the range then run the macro below; Change from your macro = replaces Cells (which means all cells on the worksheet with Selection) If you do not want to select the range before running the macro then remove the ' before the line ' Range("F6:F50").Select and change 50 to whatever you want... Use Sub Macro1() ' Range("F6:F50").Select Selection.Replace What:="O", Replacement:="", LookAt:=xlPart, _ SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _ ReplaceFormat:=False End Sub "chrisnsmith" wrote: Recorded this macro, but I only want it to work in column C from row 6 downward. What do I need to add? Cells.Replace What:="O", Replacement:="", LookAt:=xlPart, SearchOrder:= _ xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceForm -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
delete the test values, but do not delete the formulas | Excel Discussion (Misc queries) | |||
How can I delete a macro when the Delete button is not active? | Excel Worksheet Functions | |||
How to Delete a Range in Closed Workbook (to Replace Delete Query) | Excel Discussion (Misc queries) | |||
How do i delete a macro in Excel 2003 when delete isn't highlight | Excel Discussion (Misc queries) | |||
How to delete rows when List toolbar's "delete" isnt highlighted? | Excel Worksheet Functions |