Home |
Search |
Today's Posts |
#10
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I think I am not making myself clear. Let me try and see if I can explain
better. The code works fine when you click the button and when I step through it in debugg mode. My only problem is that these line of codes: With Selection .Replace What:="=$D$7", Replacement:="<""" End With the replacement is not made the =$D$7 is not replaced with <"". Eevrything else works the way they should except the replacement is not performed. "JLGWhiz" wrote: The button must be from the Control Toolbox to use the Click event. If the button is from the Control Tool box, then put a break point on the first line of the IF statement, then click the button to see if it breaks on that line and highlights if for debugging. If it does not, then check the spelling of the button name to be sure it is exactly like that shown in the properties window. If the code works when you run it manually, then the problem has to be in either the type of button you are using or the name you are using in the title line of the code. "Ayo" wrote in message ... When I run this click macro from inside a worksheet, nothing happens. The changes I am trying to make are not done but the code works fine when I run it manually. Any ideas what is going wrong? Private Sub cmdMarketRegion_Click() If Me.cmdMarketRegion.Caption = "Market" Then Me.cmdMarketRegion.Caption = "Region" Me.Range("D7,D23,D39") = "Market" Me.Cells.Select With Selection .Replace What:="=$D$7", Replacement:="<""" End With Me.Range("A2").Select ElseIf Me.cmdMarketRegion.Caption = "Region" Then Me.cmdMarketRegion.Caption = "Market" Me.Range("D7,D23,D39") = "Region" Me.Cells.Select With Selection .Replace What:="--('InSite Milestones'!$A$2:$A$9245=$E$4)", Replacement:="--('InSite Milestones'!$A$2:$A$9245<"")" End With Me.Range("A2").Select End If Me.Calculate End Sub . |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Selection.Replace Problem | Excel Discussion (Misc queries) | |||
Selection.Replace What and double quotes | Excel Programming | |||
Selection.Replace size limitation | Excel Programming | |||
Excel: Add replace within selection functionality | Excel Discussion (Misc queries) | |||
Replace Values in range selection | Excel Programming |