juneau730

Board Regular
Joined
Jun 7, 2018
Messages
111
Trying a little humor with the subject. :)

I recorded the following macro in excel, then shortened/simplified it. If I am in Developer Mode and run it from there, it works great, but.. I am trying to assign the code to a button. When I do and click the button, it appears to be running on the sheet where the button is, not the sheet where my data is.

Searching, I was not able to find how to correct this.

Code:
Sub Configure_Dates()    Range("E2:E7500").Select
    Selection.Replace What:=",", Replacement:=", ", LookAt:=xlPart, _
        SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
        ReplaceFormat:=False
    Range("F2:F7500").Select
    Selection.Replace What:="@", Replacement:=" ", LookAt:=xlPart, _
        SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
        ReplaceFormat:=False
    Range("E2:E7500").Select
    Selection.NumberFormat = "m/d/yyyy"
    Range("G2:G7500").Select
    Selection.NumberFormat = "m/d/yyyy"
    Range("H2:H7500").Select
    Selection.NumberFormat = "m/d/yyyy"
End Sub
 
It's fixed, within the protection box, it allowed me to set the specific conditions. By checking the box to allow formatting of cells, row and columns of UNLOCKED cells. By allowing this, it allows the macro to run properly, formatting the dates, but still protects (locks out) the few columns I need protected.

Thanks a ton for the help!
 
Upvote 0

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,216,091
Messages
6,128,775
Members
449,468
Latest member
AGreen17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top