Fr83
11-22-2017, 01:53 AM
Hi all,
Just wondering if anyone can help. at year end im looking to store past data in a different sheet am currently thinking this,
Private Sub CommandButton1_Click()
Dim yearNum As StringyearNum = ActiveSheet.Range("A1")
MsgBox (yearNum)
''''''in order to check what i get, as yearNum = Year(currDate) was just saying 1988
'''''here i want to try and check that the year doesnt already appear in one of the other sheets, just in case other users hit the button. dont know how to check this though, hence asking for help here
Sheets("Sheet1").Copy after:=Sheets("Sheet1")
ActiveSheet.Name = yearNum
'''' ill then activate the first sheet and clear the contents.
worksheets.sheet1.activate
Worksheets = "Sheet1".Range= ("A3:AB1000").ClearContents
If anyone could help with getting the code better and how to check for a duplicate sheet name would be greatful.
Thank.
Just wondering if anyone can help. at year end im looking to store past data in a different sheet am currently thinking this,
Private Sub CommandButton1_Click()
Dim yearNum As StringyearNum = ActiveSheet.Range("A1")
MsgBox (yearNum)
''''''in order to check what i get, as yearNum = Year(currDate) was just saying 1988
'''''here i want to try and check that the year doesnt already appear in one of the other sheets, just in case other users hit the button. dont know how to check this though, hence asking for help here
Sheets("Sheet1").Copy after:=Sheets("Sheet1")
ActiveSheet.Name = yearNum
'''' ill then activate the first sheet and clear the contents.
worksheets.sheet1.activate
Worksheets = "Sheet1".Range= ("A3:AB1000").ClearContents
If anyone could help with getting the code better and how to check for a duplicate sheet name would be greatful.
Thank.