Macro to change cell format

ste33uka

Active Member
Joined
Jan 31, 2020
Messages
346
Office Version
  1. 2019
Platform
  1. Windows
Hi would anyone have a macro that would change cell format ?
I would like cells (u5:v99999) and (x5:z99999) to text format
and
cell (w5:w99999) to number format.
Thanks
 

Some videos you may like

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
55,972
Office Version
  1. 365
Platform
  1. Windows
If you turn on your Macro Recorder, and record yourself doing this manually, you will easily get the VBA code that you need.
The Macro Recorder is a very valuable tool to use to get snippets of code like this!
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
53,240
Office Version
  1. 365
Platform
  1. Windows
Why not just record a macro of you applying the formats manually. Then you have the code.
 
Solution

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
53,240
Office Version
  1. 365
Platform
  1. Windows

ADVERTISEMENT

Any problems, just post back.
 

ste33uka

Active Member
Joined
Jan 31, 2020
Messages
346
Office Version
  1. 2019
Platform
  1. Windows
Thanks alot , think its done and thanks for tip about recording macro, might use that alot more.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
53,240
Office Version
  1. 365
Platform
  1. Windows

ADVERTISEMENT

Glad we could help & thanks for the feedback.
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
55,972
Office Version
  1. 365
Platform
  1. Windows
I am guessing that you missed the first reply, in which I told you to do this exact thing! ;)
 

ste33uka

Active Member
Joined
Jan 31, 2020
Messages
346
Office Version
  1. 2019
Platform
  1. Windows
If you turn on your Macro Recorder, and record yourself doing this manually, you will easily get the VBA code that you need.
The Macro Recorder is a very valuable tool to use to get snippets of code like this!
Thanks to joe, sorry i missed your post somehow, thanks
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
55,972
Office Version
  1. 365
Platform
  1. Windows
Thanks to joe, sorry i missed your post somehow, thanks
I think sometimes people have tendency to go right to the last reply, instead of looking at all the replies.
 

Watch MrExcel Video

Forum statistics

Threads
1,123,206
Messages
5,600,317
Members
414,376
Latest member
NickYOW

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
Top