ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Macro Help needed (https://www.excelbanter.com/excel-discussion-misc-queries/41162-macro-help-needed.html)

tamato43

Macro Help needed
 
I'm trying to record a macro but I'm having difficulty with a particular
action.

I'm trying to copy text from a particular cell, Lets say Cell A1, and then
go to the "Sheet Tabs", currently labeled Sheet 1, and paste the text to
rename the sheet.

Can Someone tell me what I'm missing from the following macro to make this
happen:

Sub Macro()
'
' Macro Macro
' Macro recorded 8/18/2005 by Anthony Amato
'

'
Range("A1").Select
Selection.Copy
Sheets("Sheet 1").Select
Sheets("Sheet 1").Name = " " (Should I add paste here? and how)
Range("B17").Select
End Sub


Any help would be greatly appreciated.


bigwheel

All you need is something like this:-

Sub Macro()
Sheets(1).Name = Range("A1").Value
Range("B17").Select
End Sub

Refer to Sheet1 by number rather than name as you can rename the sheet at
any time by changing the value in A1

"tamato43" wrote:

I'm trying to record a macro but I'm having difficulty with a particular
action.

I'm trying to copy text from a particular cell, Lets say Cell A1, and then
go to the "Sheet Tabs", currently labeled Sheet 1, and paste the text to
rename the sheet.

Can Someone tell me what I'm missing from the following macro to make this
happen:

Sub Macro()
'
' Macro Macro
' Macro recorded 8/18/2005 by Anthony Amato
'

'
Range("A1").Select
Selection.Copy
Sheets("Sheet 1").Select
Sheets("Sheet 1").Name = " " (Should I add paste here? and how)
Range("B17").Select
End Sub


Any help would be greatly appreciated.



All times are GMT +1. The time now is 09:01 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com