M
monagan
I have a worksheet, sheet 1, with Name, Date, Hours, and WorksheetName
They fill these value and runs this code with Name Date and Hours:
ENAME = Sheets("sheet1").Range("a14", "a14").Value
EDate = Sheets("sheet1").Cells(7, 8).Value
EHOURS = Sheets("sheet1").Range("a20", "a20").Value
flName = "TIME SHEETS.xls"
flPath = "C:\Documents and Settings\Jon Monagan\My Documents\Gary\"
OpenSheet = Sheets("sheet1").Cells(18, 5).Value
If Not WorkbookIsOpen(flName) Then Workbooks.Open (flPath & flName)
Set wbTS = Workbooks(flName)
wbTS.Activate
wbTS.Sheets(OpenSheet).Activate
lRow = wbTS.Sheets(OpenSheet).Columns(1).Cells.Find(ENAME,
LookIn:=xlValues).Row
iCol = wbTS.Sheets(OpenSheet).Rows(1).Cells.Find(EDate,
LookIn:=xlValues).Column
wbTS.Sheets(OpenSheet).Cells(lRow, iCol) = EHOURS
AND/Or THIS CODE with Name Date Hours And WorksheetNAme:
flName = "MISC. HOUR COMP.xls"
flPath = "C:\Documents and Settings\Jon Monagan\My Documents\Gary\"
OpenSheet = "Data"
If Not WorkbookIsOpen(flName) Then Workbooks.Open (flPath & flName)
Set wbTS = Workbooks(flName)
wbTS.Activate
wbTS.Sheets(OpenSheet).Activate
What I need is something to add to these that if it can't find the name
or date in the first block of code, add the date or name
In the second block of code I need something that will insert a new
worksheet and name it the specified name if it can't find it.
Any ideas? or direction
They fill these value and runs this code with Name Date and Hours:
ENAME = Sheets("sheet1").Range("a14", "a14").Value
EDate = Sheets("sheet1").Cells(7, 8).Value
EHOURS = Sheets("sheet1").Range("a20", "a20").Value
flName = "TIME SHEETS.xls"
flPath = "C:\Documents and Settings\Jon Monagan\My Documents\Gary\"
OpenSheet = Sheets("sheet1").Cells(18, 5).Value
If Not WorkbookIsOpen(flName) Then Workbooks.Open (flPath & flName)
Set wbTS = Workbooks(flName)
wbTS.Activate
wbTS.Sheets(OpenSheet).Activate
lRow = wbTS.Sheets(OpenSheet).Columns(1).Cells.Find(ENAME,
LookIn:=xlValues).Row
iCol = wbTS.Sheets(OpenSheet).Rows(1).Cells.Find(EDate,
LookIn:=xlValues).Column
wbTS.Sheets(OpenSheet).Cells(lRow, iCol) = EHOURS
AND/Or THIS CODE with Name Date Hours And WorksheetNAme:
flName = "MISC. HOUR COMP.xls"
flPath = "C:\Documents and Settings\Jon Monagan\My Documents\Gary\"
OpenSheet = "Data"
If Not WorkbookIsOpen(flName) Then Workbooks.Open (flPath & flName)
Set wbTS = Workbooks(flName)
wbTS.Activate
wbTS.Sheets(OpenSheet).Activate
What I need is something to add to these that if it can't find the name
or date in the first block of code, add the date or name
In the second block of code I need something that will insert a new
worksheet and name it the specified name if it can't find it.
Any ideas? or direction