Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Variable sum from defined input | Excel Worksheet Functions | |||
variable not defined, ActiveWorkbook.name | 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 | |||
Variable Not Defined? objPivotCache | Excel Programming |