cameronem20
MIS
Hello,
I realise this is a very basic query as I am not used to using VBA. What I am wanting to do is paste the contents of cell A1 on worksheet Control to rename other worksheets. What I am finding is that when using the wizard to record the macro it is using the value used in the cell when the macro was recorded rather than whatever is in the cell.
Also is it possible to use these contents to rename the first part of a worksheet name (ie. I am copying a worksheet and renaming the first part of it eg CSR summary to clipboard contents summary))
The following is the code there at the moment.
Sub NewCSR()
'
' NewCSR Macro
' Macro recorded 20/03/2004 by Administrator
'
'
Sheets("Template").Select
Sheets("Template").Copy After:=Sheets(5)
Sheets("CSR summary").Select
Sheets("CSR summary").Copy After:=Sheets(6)
Sheets("Control").Select
Range("A1").Select
Selection.Copy
Sheets("Template (2)").Select
Application.CutCopyMode = False
Sheets("Template (2)").Name = "Joe"
Range("E5").Select
Sheets("Control").Select
Range("A1").Select
Selection.Copy
Sheets("CSR summary (2)").Select
Application.CutCopyMode = False
Sheets("CSR summary (2)").Name = "Joe summary"
Range("A22").Select
Sheets("Control").Select
End Sub
Thanks heaps
I realise this is a very basic query as I am not used to using VBA. What I am wanting to do is paste the contents of cell A1 on worksheet Control to rename other worksheets. What I am finding is that when using the wizard to record the macro it is using the value used in the cell when the macro was recorded rather than whatever is in the cell.
Also is it possible to use these contents to rename the first part of a worksheet name (ie. I am copying a worksheet and renaming the first part of it eg CSR summary to clipboard contents summary))
The following is the code there at the moment.
Sub NewCSR()
'
' NewCSR Macro
' Macro recorded 20/03/2004 by Administrator
'
'
Sheets("Template").Select
Sheets("Template").Copy After:=Sheets(5)
Sheets("CSR summary").Select
Sheets("CSR summary").Copy After:=Sheets(6)
Sheets("Control").Select
Range("A1").Select
Selection.Copy
Sheets("Template (2)").Select
Application.CutCopyMode = False
Sheets("Template (2)").Name = "Joe"
Range("E5").Select
Sheets("Control").Select
Range("A1").Select
Selection.Copy
Sheets("CSR summary (2)").Select
Application.CutCopyMode = False
Sheets("CSR summary (2)").Name = "Joe summary"
Range("A22").Select
Sheets("Control").Select
End Sub
Thanks heaps