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

Hi there,

I am trying to use this code to make sure a value doesn't exist in the
Copreco Master Log. I get an error that says 'variable not defined' and it
highlights ' the "mydate" row.

I am not sure what is wrong...any ideas?


Assumes both workbooks are open:
Sub ckDte()
Dim wkb1 as Workbook
Dim wkb2 as workbook
Set wkb1 = Workbooks("Corpreco Daily Reading Submission.xls")
Set wkb2 = workbooks("Corpreco Master Log.xls")
myDte = wkb1.Sheets("Sheet1").Cells(2, 1).Value
For Each c In wkb2.Sheets("Daily Reading Master Log").Range("B2:B" & Cells
_(Rows.Count, 2).End(xlUp).Row)
If c = myDte Then
MsgBox "Date Found"
Exit Sub
End If
Exit Sub


--
Carlee
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default variable not defined

carlee, carlee, carlee............. ha ha

"mydate" is a variable.
"mydate" is not defined.
EVERYTHING has to be defined.............. :D
you made a good start with
Dim wkb1 as Workbook
Dim wkb2 as workbook


but then you refer to the following variables without declaring them:
"mydate" & "c"

Dim myDate as _____________
Dim c as __________________
:)
susan


"Carlee" wrote in message
...
Hi there,

I am trying to use this code to make sure a value doesn't exist in the
Copreco Master Log. I get an error that says 'variable not defined' and
it
highlights ' the "mydate" row.

I am not sure what is wrong...any ideas?


Assumes both workbooks are open:
Sub ckDte()
Dim wkb1 as Workbook
Dim wkb2 as workbook
Set wkb1 = Workbooks("Corpreco Daily Reading Submission.xls")
Set wkb2 = workbooks("Corpreco Master Log.xls")
myDte = wkb1.Sheets("Sheet1").Cells(2, 1).Value
For Each c In wkb2.Sheets("Daily Reading Master Log").Range("B2:B" & Cells
_(Rows.Count, 2).End(xlUp).Row)
If c = myDte Then
MsgBox "Date Found"
Exit Sub
End If
Exit Sub


--
Carlee



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default variable not defined

i hope you know i was just pulling your leg.......
no offense
:)
susan

"Carlee" wrote in message
...
Hi there,

I am trying to use this code to make sure a value doesn't exist in the
Copreco Master Log. I get an error that says 'variable not defined' and
it
highlights ' the "mydate" row.

I am not sure what is wrong...any ideas?


Assumes both workbooks are open:
Sub ckDte()
Dim wkb1 as Workbook
Dim wkb2 as workbook
Set wkb1 = Workbooks("Corpreco Daily Reading Submission.xls")
Set wkb2 = workbooks("Corpreco Master Log.xls")
myDte = wkb1.Sheets("Sheet1").Cells(2, 1).Value
For Each c In wkb2.Sheets("Daily Reading Master Log").Range("B2:B" & Cells
_(Rows.Count, 2).End(xlUp).Row)
If c = myDte Then
MsgBox "Date Found"
Exit Sub
End If
Exit Sub


--
Carlee



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
Variable sum from defined input David Excel Worksheet Functions 7 March 10th 09 06:26 AM
variable not defined, ActiveWorkbook.name Janis Excel Programming 1 September 1st 06 08:30 PM
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 4 May 12th 04 10:21 AM
Variable Not Defined? objPivotCache BEE Excel Programming 1 December 15th 03 05:02 PM


All times are GMT +1. The time now is 10:51 PM.

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"