Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I'm trying to do a macro thatdoes 2 things: 1- Rename the active Tab with the content of a cell in it dimvar = Date1 Range("AB2").Select (?)Selection.Copy = Date1 ActiveWorkbook.Worksheets.Select (???).Name = Date Range("A4").Select End Sub 2- Then, use this same Tab name and add it after an other word Case-Date1.xlsm Michel |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dim wks as worksheet
set wks = activesheet with wks .name = .range("Ab2").value 'or if AB2 contains a date, you can make sure that the 'value is legal (sheet names can't contain /'s). .name = Format(.range("AB2").value, "yyyy-mm-dd") end with and maybe... dim myStr as string Dim wks as worksheet set wks = activesheet with wks .name = .range("Ab2").value 'or if AB2 contains a date, you can make sure that the 'value is legal (sheet names can't contain /'s). .name = Format(.range("AB2").value, "yyyy-mm-dd") mystr = "Case-" & .name & ".xlsm" end with Construk wrote: Hi, I'm trying to do a macro thatdoes 2 things: 1- Rename the active Tab with the content of a cell in it dimvar = Date1 Range("AB2").Select (?)Selection.Copy = Date1 ActiveWorkbook.Worksheets.Select (???).Name = Date Range("A4").Select End Sub 2- Then, use this same Tab name and add it after an other word Case-Date1.xlsm Michel -- Dave Peterson |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Dave!
"Dave Peterson" wrote: Dim wks as worksheet set wks = activesheet with wks .name = .range("Ab2").value 'or if AB2 contains a date, you can make sure that the 'value is legal (sheet names can't contain /'s). .name = Format(.range("AB2").value, "yyyy-mm-dd") end with and maybe... dim myStr as string Dim wks as worksheet set wks = activesheet with wks .name = .range("Ab2").value 'or if AB2 contains a date, you can make sure that the 'value is legal (sheet names can't contain /'s). .name = Format(.range("AB2").value, "yyyy-mm-dd") mystr = "Case-" & .name & ".xlsm" end with Construk wrote: Hi, I'm trying to do a macro thatdoes 2 things: 1- Rename the active Tab with the content of a cell in it dimvar = Date1 Range("AB2").Select (?)Selection.Copy = Date1 ActiveWorkbook.Worksheets.Select (???).Name = Date Range("A4").Select End Sub 2- Then, use this same Tab name and add it after an other word Case-Date1.xlsm Michel -- Dave Peterson . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Save and rename | Excel Discussion (Misc queries) | |||
Rename files and save them as pdf | Excel Programming | |||
Auto rename and save prompt needed. | Excel Worksheet Functions | |||
Macros in Excel - Save as and rename file | Excel Programming | |||
Macros in Excel - Save as and rename file | Excel Programming |