Assigning Macro to Cell and Running Macro Once Entry in Cell is Complete Without Opening Macro Run Window

jschalmers

New Member
Joined
Jun 24, 2019
Messages
5
Hi Everyone,

I'm new to the whole VBA thing, and need to create a macro that will assign a group of merged cells as text (so you don't have to insert an apostrophe (') to mark it as text (content in the cell will likely commence with a dash (-)), auto-fit the row height of the merged cells, and have that macro assigned to the group of merged cells, with the macro being run when the user hits 'Enter' to move out of the assigned cell.:eek::eek:

Help??

Thank you so much!

Jenn
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Jenn

You can't assign a macro to a cell/range, however you might want to consider using the worksheet Change event.

The worksheet Change event is triggered whenever a change is made on the worksheet, here's the code stub for it,
Code:
Private Sub Worksheet_Change(ByVal Target As Range)

End Sub

which goes in the worksheet module.

If you look at the header of the above sub you'll see that there's an argument, Target, passed to the sub.

That argument is a reference to the range(s) that on the worksheet that has been changed and you can use it to determine what action to take.
 
Upvote 0

Forum statistics

Threads
1,213,484
Messages
6,113,927
Members
448,533
Latest member
thietbibeboiwasaco

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