Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Macro edits won't work

The first 3 commands of this macro work fine. Not knowing much about VBA, to
try to add 2 more commands, I copied and pasted a working command twice and
substituted the characters I wanted to manipulate in commands 4 and 5.

Commands 4 and 5 don't work.

How can I troubleshoot this and see where is the problem so I can correct it.

Tx for your help. The macro is as follows (hopefully it is readable in this
forum)"


Sub Second_Macro_Rate_Comparisons()
'
' Change_Cellular_in_parentheses Macro
' Macro recorded 3/4/2005 by Edits
'

'
Cells.Replace What:=" (Cellular)", Replacement:="-Cellular", LookAt:= _
xlPart, SearchOrder:=xlByRows, MatchCase:=False,
SearchFormat:=False, _
ReplaceFormat:=False
Cells.Replace What:=" GSM", Replacement:="-Cellular", LookAt:= _
xlPart, SearchOrder:=xlByRows, MatchCase:=False,
SearchFormat:=False, _
ReplaceFormat:=False
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
Cells.Replace What:=")", Replacement:="", LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False, SearchFormat:=False,
ReplaceFormat:=False
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default Macro edits won't work

This worked for me... I just removed some of the default values...

Sub Second_Macro_Rate_Comparisons()
Cells.Replace What:=" (Cellular)", Replacement:="-Cellular",
LookAt:=xlPart
Cells.Replace What:=" GSM", Replacement:="-Cellular", LookAt:=xlPart
Cells.Replace What:=" - ", Replacement:="-", LookAt:=xlPart
Cells.Replace What:="(", Replacement:="-", LookAt:=xlPart
Cells.Replace What:=")", Replacement:="", LookAt:=xlPart
End Sub
--
HTH...

Jim Thomlinson


"Tenacity" wrote:

The first 3 commands of this macro work fine. Not knowing much about VBA, to
try to add 2 more commands, I copied and pasted a working command twice and
substituted the characters I wanted to manipulate in commands 4 and 5.

Commands 4 and 5 don't work.

How can I troubleshoot this and see where is the problem so I can correct it.

Tx for your help. The macro is as follows (hopefully it is readable in this
forum)"


Sub Second_Macro_Rate_Comparisons()
'
' Change_Cellular_in_parentheses Macro
' Macro recorded 3/4/2005 by Edits
'

'
Cells.Replace What:=" (Cellular)", Replacement:="-Cellular", LookAt:= _
xlPart, SearchOrder:=xlByRows, MatchCase:=False,
SearchFormat:=False, _
ReplaceFormat:=False
Cells.Replace What:=" GSM", Replacement:="-Cellular", LookAt:= _
xlPart, SearchOrder:=xlByRows, MatchCase:=False,
SearchFormat:=False, _
ReplaceFormat:=False
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
Cells.Replace What:=")", Replacement:="", LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False, SearchFormat:=False,
ReplaceFormat:=False
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Macro edits won't work

Tx.

For some reason, the macro is not finding the ( or ). At first I thought
maybe ( is not the ( character, but when I do a Find command, it finds the
cell containing the ( just fine. For some reason, the macro is not changing
the ( or ) as requested. Any suggestions?

"Jim Thomlinson" wrote:

This worked for me... I just removed some of the default values...

Sub Second_Macro_Rate_Comparisons()
Cells.Replace What:=" (Cellular)", Replacement:="-Cellular",
LookAt:=xlPart
Cells.Replace What:=" GSM", Replacement:="-Cellular", LookAt:=xlPart
Cells.Replace What:=" - ", Replacement:="-", LookAt:=xlPart
Cells.Replace What:="(", Replacement:="-", LookAt:=xlPart
Cells.Replace What:=")", Replacement:="", LookAt:=xlPart
End Sub
--
HTH...

Jim Thomlinson


"Tenacity" wrote:

The first 3 commands of this macro work fine. Not knowing much about VBA, to
try to add 2 more commands, I copied and pasted a working command twice and
substituted the characters I wanted to manipulate in commands 4 and 5.

Commands 4 and 5 don't work.

How can I troubleshoot this and see where is the problem so I can correct it.

Tx for your help. The macro is as follows (hopefully it is readable in this
forum)"


Sub Second_Macro_Rate_Comparisons()
'
' Change_Cellular_in_parentheses Macro
' Macro recorded 3/4/2005 by Edits
'

'
Cells.Replace What:=" (Cellular)", Replacement:="-Cellular", LookAt:= _
xlPart, SearchOrder:=xlByRows, MatchCase:=False,
SearchFormat:=False, _
ReplaceFormat:=False
Cells.Replace What:=" GSM", Replacement:="-Cellular", LookAt:= _
xlPart, SearchOrder:=xlByRows, MatchCase:=False,
SearchFormat:=False, _
ReplaceFormat:=False
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
Cells.Replace What:=")", Replacement:="", LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False, SearchFormat:=False,
ReplaceFormat:=False
End Sub

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default Macro edits won't work

By any chance are the brackets part of a cell format and not an actual
character within the cell. My guess is that you need to just change the
formatting of the cells.
--
HTH...

Jim Thomlinson


"Tenacity" wrote:

Tx.

For some reason, the macro is not finding the ( or ). At first I thought
maybe ( is not the ( character, but when I do a Find command, it finds the
cell containing the ( just fine. For some reason, the macro is not changing
the ( or ) as requested. Any suggestions?

"Jim Thomlinson" wrote:

This worked for me... I just removed some of the default values...

Sub Second_Macro_Rate_Comparisons()
Cells.Replace What:=" (Cellular)", Replacement:="-Cellular",
LookAt:=xlPart
Cells.Replace What:=" GSM", Replacement:="-Cellular", LookAt:=xlPart
Cells.Replace What:=" - ", Replacement:="-", LookAt:=xlPart
Cells.Replace What:="(", Replacement:="-", LookAt:=xlPart
Cells.Replace What:=")", Replacement:="", LookAt:=xlPart
End Sub
--
HTH...

Jim Thomlinson


"Tenacity" wrote:

The first 3 commands of this macro work fine. Not knowing much about VBA, to
try to add 2 more commands, I copied and pasted a working command twice and
substituted the characters I wanted to manipulate in commands 4 and 5.

Commands 4 and 5 don't work.

How can I troubleshoot this and see where is the problem so I can correct it.

Tx for your help. The macro is as follows (hopefully it is readable in this
forum)"


Sub Second_Macro_Rate_Comparisons()
'
' Change_Cellular_in_parentheses Macro
' Macro recorded 3/4/2005 by Edits
'

'
Cells.Replace What:=" (Cellular)", Replacement:="-Cellular", LookAt:= _
xlPart, SearchOrder:=xlByRows, MatchCase:=False,
SearchFormat:=False, _
ReplaceFormat:=False
Cells.Replace What:=" GSM", Replacement:="-Cellular", LookAt:= _
xlPart, SearchOrder:=xlByRows, MatchCase:=False,
SearchFormat:=False, _
ReplaceFormat:=False
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
Cells.Replace What:=")", Replacement:="", LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False, SearchFormat:=False,
ReplaceFormat:=False
End Sub

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Macro edits won't work

Right on! They should have been text, but whoever entered them somehow made
them as part of a formula. Formatting the entire column to Text worked.
Many thanks.

"Jim Thomlinson" wrote:

By any chance are the brackets part of a cell format and not an actual
character within the cell. My guess is that you need to just change the
formatting of the cells.
--
HTH...

Jim Thomlinson


"Tenacity" wrote:

Tx.

For some reason, the macro is not finding the ( or ). At first I thought
maybe ( is not the ( character, but when I do a Find command, it finds the
cell containing the ( just fine. For some reason, the macro is not changing
the ( or ) as requested. Any suggestions?

"Jim Thomlinson" wrote:

This worked for me... I just removed some of the default values...

Sub Second_Macro_Rate_Comparisons()
Cells.Replace What:=" (Cellular)", Replacement:="-Cellular",
LookAt:=xlPart
Cells.Replace What:=" GSM", Replacement:="-Cellular", LookAt:=xlPart
Cells.Replace What:=" - ", Replacement:="-", LookAt:=xlPart
Cells.Replace What:="(", Replacement:="-", LookAt:=xlPart
Cells.Replace What:=")", Replacement:="", LookAt:=xlPart
End Sub
--
HTH...

Jim Thomlinson


"Tenacity" wrote:

The first 3 commands of this macro work fine. Not knowing much about VBA, to
try to add 2 more commands, I copied and pasted a working command twice and
substituted the characters I wanted to manipulate in commands 4 and 5.

Commands 4 and 5 don't work.

How can I troubleshoot this and see where is the problem so I can correct it.

Tx for your help. The macro is as follows (hopefully it is readable in this
forum)"


Sub Second_Macro_Rate_Comparisons()
'
' Change_Cellular_in_parentheses Macro
' Macro recorded 3/4/2005 by Edits
'

'
Cells.Replace What:=" (Cellular)", Replacement:="-Cellular", LookAt:= _
xlPart, SearchOrder:=xlByRows, MatchCase:=False,
SearchFormat:=False, _
ReplaceFormat:=False
Cells.Replace What:=" GSM", Replacement:="-Cellular", LookAt:= _
xlPart, SearchOrder:=xlByRows, MatchCase:=False,
SearchFormat:=False, _
ReplaceFormat:=False
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
Cells.Replace What:=")", Replacement:="", LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False, SearchFormat:=False,
ReplaceFormat:=False
End Sub

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
Insert "Find dialog box" edits into macro danno-c[_2_] Excel Discussion (Misc queries) 3 September 24th 09 05:40 PM
Macro to Protect the Whole Workbook and Allow Range Edits EugeniaP Excel Discussion (Misc queries) 2 September 8th 08 05:43 PM
Can I allow Additions but not Edits? Keith Excel Discussion (Misc queries) 2 November 9th 06 01:10 PM
Footer edits Sheilamom Excel Discussion (Misc queries) 1 June 5th 06 02:20 PM
Limiting edits alexandra60 Excel Discussion (Misc queries) 3 February 8th 06 09:55 AM


All times are GMT +1. The time now is 02:59 PM.

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"