General discussion

Using Macro's to rename Excel worksheets?

I need a macro that will rename a worksheet to the text that is written in a cell on my spreadsheet, help anyone?

Discussion is locked

Follow
Reply to: Using Macro's to rename Excel worksheets?
PLEASE NOTE: Do not post advertisements, offensive materials, profanity, or personal attacks. Please remember to be considerate of other members. If you are new to the CNET Forums, please read our CNET Forums FAQ. All submitted content is subject to our Terms of Use.
Reporting: Using Macro's to rename Excel worksheets?
This post has been flagged and will be reviewed by our staff. Thank you for helping us maintain CNET's great community.
Sorry, there was a problem flagging this post. Please try again now or at a later time.
If you believe this post is offensive or violates the CNET Forums' Usage policies, you can report it below (this will not automatically remove the post). Once reported, our moderators will be notified and the post will be reviewed.
Comments
- Collapse -
Use macro recording ...

to get the basic code to rename a worksheet.

Then finish it with some code like
Worksheets("A").Select
Range("C2").Select
and replace the new name of the worksheet in the code by Selection.Value
This assumes that the new name is in cell C2 of worksheet A.

Hope this helps.


Kees

- Collapse -
Didn't work

It didnt work it gives an error message saying object doesnt support this property or method

- Collapse -
Re: didn't work.

Mr X,

Please post the whole code of the macro that you assembled, and also tell precisely what statement gives the error message (and the full text of the error message, and the version of Excel). It seems you produce illegal code.
I suppose swisse (one of our valued members) will be able to correct the error you obviously made.

Hope this helps.


Kees

- Collapse -
Fixed it

Looks like my last message didnt post (or i posted it in the wrong thread) but ive got the code working now, thanks

CNET Forums

Forum Info