Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default Variable not defined?

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!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Variable not defined?

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!


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default Variable not defined?

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.
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Variable not defined?

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.

  #5   Report Post  
Posted to microsoft.public.excel.programming
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.


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Variable not defined?

The archives would like to see your final code

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"davegb" wrote in message
...
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.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Public Variable - not defined? Clayman Excel Programming 8 July 27th 07 01:24 PM
variable not defined Carlee Excel Programming 2 April 26th 07 08:56 PM
For Each cell - Variable not defined (VBA) Shlomit Excel Programming 2 January 25th 07 08:39 AM
why is it saying sheetcnt is "variable not defined" how to do a global variable to share over multiple functions in vba for excel? Daniel Excel Worksheet Functions 1 July 9th 05 03:05 AM
[Q] msoShapeRectangle: variable not defined Rolf Marvin Bøe Lindgren Excel Programming 0 May 12th 04 09:00 AM


All times are GMT +1. The time now is 04:47 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"