Jump to content
SAU Community

Inner West Crew Whoretown (toowong/st Lucia/kenmore/indooroopilly And Sometimes Sunnybank?)


funkymonkey

Recommended Posts

Else

WSname = ActiveCell.Value

Set wsheet = Worksheets(WSname)

If wsheet Is Nothing Then

Set TemplateSheet = Worksheets("Template")

TemplateSheet.Copy after:=Sheets(1)

ActiveSheet.Name = WSname

ActiveSheet.Range("C3").Value = WSname

ActiveSheet.Range("C4").Value = ""

Call CopyData

Else

Call CopyData

End If

Anyone can solve this for me?

WSname = ActiveCell.Value ====> this shit works

Set wsheet = Worksheets(WSname) ====> but this doesnt.

Apparently it doesnt work because that sheet doesnt exist. Maybe I can use this error (on error goto) to skip to the next step which I want to do??

I'm trying to check if the sheet exist or not. And ths sheet that I'm check is variable.

Link to comment
Share on other sites

Else

WSname = ActiveCell.Value

Set wsheet = Worksheets(WSname)

If wsheet Is Nothing Then

Set TemplateSheet = Worksheets("Template")

TemplateSheet.Copy after:=Sheets(1)

ActiveSheet.Name = WSname

ActiveSheet.Range("C3").Value = WSname

ActiveSheet.Range("C4").Value = ""

Call CopyData

Else

Call CopyData

End If

Anyone can solve this for me?

WSname = ActiveCell.Value ====> this shit works

Set wsheet = Worksheets(WSname) ====> but this doesnt.

Apparently it doesnt work because that sheet doesnt exist. Maybe I can use this error (on error goto) to skip to the next step which I want to do??

I'm trying to check if the sheet exist or not. And ths sheet that I'm check is variable.

x zero.

Link to comment
Share on other sites

Brandon, does it not work all the time, or only not work if the sheet doesnt exist?

The on error goto WORKED! That bit on Set wsheet = Worksheets(WSname), only work if the sheet exist. So I dont know how the f**k you're suppose to check a variable sheetname. It'll only work if you wanna check a pre-specified sheetname.

Now I've got another problem of making the sheet active again because of that. This macro shit is fun and time flies when you're troubleshooting

Link to comment
Share on other sites

excel macros are sh!t coz they are still based on VB6 which came out about when i was in primary school :S

programming languages have come so far since then but macros are still stuck in the stone ages

to make the sheet active wsheet.activate() or something like that should do it.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...