Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Macro to rename Tab and then save as

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Macro to rename Tab and then save as

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Macro to rename Tab and then save as

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
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
Save and rename Steve Excel Discussion (Misc queries) 6 February 27th 09 04:22 PM
Rename files and save them as pdf Braca[_2_] Excel Programming 4 February 11th 07 05:27 PM
Auto rename and save prompt needed. Gizmo63 Excel Worksheet Functions 0 February 7th 06 02:00 PM
Macros in Excel - Save as and rename file Tom Ogilvy Excel Programming 0 August 13th 03 12:13 PM
Macros in Excel - Save as and rename file Bob Phillips[_5_] Excel Programming 0 August 13th 03 09:28 AM


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