I am working on a VBA macro in Excel that will copy a sheet move it and then rename it based on what the user enters in a pop up box. Here is my code for the module:
frmShow.Show
Sheets("Jun 09 New").Select
Sheets("Jun 09 New").Copy Before:=Sheets( frmShow.txtCopy Sheet.Text)
Sheets("Jun 09 New (2)").Select
Sheets("Jun 09 New (2)").Move After:=Sheets(f rmShow.txtCopyS heet.Text)
Sheets("Jun 09 New (2)").Select
Sheets("Jun 09 New (2)").Name = frmShow.txtNewS heet.Text
Columns("I:I"). Select
Selection.Copy
Columns("H:H"). Select
Selection.Inser t Shift:=xlToRigh t
Columns("J:J"). Select
Application.Cut CopyMode = False
Selection.Clear Contents
Range("J1").Sel ect
Selection.Numbe rFormat = "@"
Range("J1").Sel ect
ActiveCell.Form ulaR1C1 = frmShow.txtNewS heet.Text
Range("J2").Sel ect
Where it has Sheets("Jun 09 New") is there a way to put the text property of a text box like I have on this line of code Sheets("Jun 09 New").Copy Before:=Sheets( frmShow.txtCopy Sheet.Text). It works as is, but I want to be able to have the user select a sheet to copy, then place it after that and name it the Name they put in the text box.
frmShow.Show
Sheets("Jun 09 New").Select
Sheets("Jun 09 New").Copy Before:=Sheets( frmShow.txtCopy Sheet.Text)
Sheets("Jun 09 New (2)").Select
Sheets("Jun 09 New (2)").Move After:=Sheets(f rmShow.txtCopyS heet.Text)
Sheets("Jun 09 New (2)").Select
Sheets("Jun 09 New (2)").Name = frmShow.txtNewS heet.Text
Columns("I:I"). Select
Selection.Copy
Columns("H:H"). Select
Selection.Inser t Shift:=xlToRigh t
Columns("J:J"). Select
Application.Cut CopyMode = False
Selection.Clear Contents
Range("J1").Sel ect
Selection.Numbe rFormat = "@"
Range("J1").Sel ect
ActiveCell.Form ulaR1C1 = frmShow.txtNewS heet.Text
Range("J2").Sel ect
Where it has Sheets("Jun 09 New") is there a way to put the text property of a text box like I have on this line of code Sheets("Jun 09 New").Copy Before:=Sheets( frmShow.txtCopy Sheet.Text). It works as is, but I want to be able to have the user select a sheet to copy, then place it after that and name it the Name they put in the text box.
Comment