Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help needed for Visual Basic 6.0 Macro to rename an Excel WS

I'm new to VB 6.0. I want help writing a macro to rename an existing Excel
worksheet using a value that is contained in a cell on another worksheet in
the same workbook.

If I use:
worksheets("sheet1").name=MonthName(1,1) the sheet is renamed JAN.
However if I use:
....MonthName("report_month",1) where "report_month" (with or without
quotation marks) refers to a cell that contains the number 1, I get zip.

If I use an message box to display the value of "report_month", the box
displays the location of the cell named "report_month".

How can I get MonthName to recognize the VALUE of the contents of "R-M"?

Many thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Help needed for Visual Basic 6.0 Macro to rename an Excel WS

Possibly

Sheets("Sheet1").Name = Range("A1").Value

Mike

"JTE and ECJT" wrote:

I'm new to VB 6.0. I want help writing a macro to rename an existing Excel
worksheet using a value that is contained in a cell on another worksheet in
the same workbook.

If I use:
worksheets("sheet1").name=MonthName(1,1) the sheet is renamed JAN.
However if I use:
....MonthName("report_month",1) where "report_month" (with or without
quotation marks) refers to a cell that contains the number 1, I get zip.

If I use an message box to display the value of "report_month", the box
displays the location of the cell named "report_month".

How can I get MonthName to recognize the VALUE of the contents of "R-M"?

Many thanks.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help needed for Visual Basic 6.0 Macro to rename an Excel WS

Mike - sorry that it took so long to get back to you. I thought that I had
set up auto notification of replies but must not have done so.

Thanks - I'll give your solution a try. It makes sense to me.

"Mike H" wrote:

Possibly

Sheets("Sheet1").Name = Range("A1").Value

Mike

"JTE and ECJT" wrote:

I'm new to VB 6.0. I want help writing a macro to rename an existing Excel
worksheet using a value that is contained in a cell on another worksheet in
the same workbook.

If I use:
worksheets("sheet1").name=MonthName(1,1) the sheet is renamed JAN.
However if I use:
....MonthName("report_month",1) where "report_month" (with or without
quotation marks) refers to a cell that contains the number 1, I get zip.

If I use an message box to display the value of "report_month", the box
displays the location of the cell named "report_month".

How can I get MonthName to recognize the VALUE of the contents of "R-M"?

Many thanks.

Reply
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
Can I run Visual Basic procedure using Excel Visual Basic editor? john.jacobs71[_2_] Excel Programming 3 December 26th 05 02:22 PM
Visual Basic code help needed Rick Excel Programming 8 July 28th 04 02:16 AM
Visual Basic macro to do something that is done trhough an Excel function Thierry[_2_] Excel Programming 2 December 11th 03 08:58 AM
visual basic macro in excel Patrick Molloy[_9_] Excel Programming 0 July 23rd 03 09:12 AM
visual basic macro in excel Patrick Molloy Excel Programming 0 July 23rd 03 07:49 AM


All times are GMT +1. The time now is 06:58 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"