Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
Variable not defined?
|
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
Variable not defined?
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Public Variable - not defined? | Excel Programming | |||
variable not defined | Excel Programming | |||
For Each cell - Variable not defined (VBA) | Excel Programming | |||
why is it saying sheetcnt is "variable not defined" how to do a global variable to share over multiple functions in vba for excel? | Excel Worksheet Functions | |||
[Q] msoShapeRectangle: variable not defined | Excel Programming |