#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 96
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,805
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 96
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 96
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 96
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default 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
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
delete the test values, but do not delete the formulas kathy Excel Discussion (Misc queries) 1 February 21st 07 07:03 PM
How can I delete a macro when the Delete button is not active? FCR Excel Worksheet Functions 0 March 9th 06 09:43 AM
How to Delete a Range in Closed Workbook (to Replace Delete Query) [email protected] Excel Discussion (Misc queries) 1 March 8th 06 10:10 AM
How do i delete a macro in Excel 2003 when delete isn't highlight Abel Excel Discussion (Misc queries) 2 September 13th 05 04:09 AM
How to delete rows when List toolbar's "delete" isnt highlighted? Linda Excel Worksheet Functions 1 May 26th 05 08:39 PM


All times are GMT +1. The time now is 10:12 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"