View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
davegb[_2_] davegb[_2_] is offline
external usenet poster
 
Posts: 72
Default Variable not defined?

On Mar 19, 1:12*pm, "Don Guillett" wrote:
I just tested your code and it did not run.???

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"davegb" wrote in message

...
On Mar 18, 4:26 pm, "Don Guillett" wrote:



Option Explicit


Sub WklySumWS()
Dim wbWkly As Workbook
Dim wsWklyLst As Worksheet
Dim wsWklySum As Worksheet
Dim sWklyShtName As String


Set wsWklyLst = ActiveSheet
sWklyShtName = wsWklyLst.Name
'=========
Sheets.Add
ActiveSheet.Name = sWklyShtName & " Summary"
]=============
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"davegb" wrote in message


...


I just started writing some new code, went to test the first few
lines, but I'm getting a "variable not defined" error on the name of
my subroutine. Anybody know what's wrong with the name?


Sub WklySumWS() <------- VARIABLE NOT DEFINED


Dim wbWkly As Workbook
Dim wsWklyLst As Worksheet
Dim wsWklySum As Worksheet
Dim sWklyShtName As String


Set wsWklyLst = ActiveSheet
sWklyShtName = wsWklyLst.Name


Sheets.Add.Activate
wsWklySum = ActiveSheet
ActiveSheet.Name = sWklyShtName & " Summary"
End Sub


Thanks for the help!- Hide quoted text -


- Show quoted text


Thanks for the reply, Don. It seems strange, after I posted, I want
back and ran the macro again, from the app rather then from the VBE,
and it ran. Don't understand that, but at least next time I get that
message I'll know to try running it from the app.- Hide quoted text -

- Show quoted text -


I misspoke in my previous post. Originally, it would run because I was
getting the "Variable not defined" message, which went away when I ran
it from the app. There were other errors in the untested code that
came up when I attempted to run it, but the "Variable not defined"
message was gone, so I withdrew my original post, but you had already
answered. Got it running now. Thanks for the help.