![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Location: Hengelo
Posts: 79
|
Hi,
I have several sheets and in range A1 are standing names. E.g. Sheet 1 range A1 = Mike Sheet 2 range A1 = John Etc. I want to change the sheet names into the names standing in A1. How do I do that in VB!
__________________
Best regards, Martin J.A. Maatman Oonk |
|
|
|
|
|
#2 |
|
New Member
Join Date: May 2002
Location: Netherlands
Posts: 6
|
In code you could use the following:
withing the 'This workbook' form add the following sub: private sub workbook_sheetchange (byval sh as object, byval target as range) 'excel sets the values in parenthesis automatically. if target.column = 1 and target.row = 1 then activesheet.name = target.value endsub |
|
|
|
|
|
#3 |
|
New Member
Join Date: May 2002
Location: Netherlands
Posts: 6
|
By the way, this does change the sheetname everytime you change a1. In the target, the column is the "a" and the row is the "1" so if you decide to use another location, just change tose column and row values.
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|