LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #10   Report Post  
Posted to microsoft.public.excel.programming
Ayo Ayo is offline
external usenet poster
 
Posts: 489
Default Help with Selection.Replace

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
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
Selection.Replace Problem Dave Excel Discussion (Misc queries) 8 September 20th 07 06:23 PM
Selection.Replace What and double quotes Ed Peters Excel Programming 5 September 15th 07 03:56 PM
Selection.Replace size limitation Stopfordian Excel Programming 2 December 5th 06 10:07 AM
Excel: Add replace within selection functionality Marcel XL Excel Discussion (Misc queries) 1 March 3rd 06 01:51 PM
Replace Values in range selection Terri Excel Programming 3 December 28th 05 12:27 AM


All times are GMT +1. The time now is 06:32 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"