Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Unfortunatly, I am also not experienced enough to figure out what I have
done wrong. Please take a look at this horrible code and tell me what I have done wrong. The point of this is to automatically update information when the workbook is opened. This is a time off tracking sheet. there is a master blank copy used for creating new sheets. A census form that is a repository for other general informatoin for all employees. Vac&Sick sheet is an index similiar to the census form. Each remaining sheet is the individuals record fo time taken off. Thanks for helping and if you have any questions let me know. By the way, this started with another thread but I have lost it somehow. For whatever reason I am unable to access my old thread. Sorry for any confusion or reposting that has occured. LWhite Sub Workbook_Open() Dim wks As Worksheet For Each wks In ActiveWorkbook.wks ' pick an employee record to evaluate rather than the master and system sheets ' If LCase(wks.Name) = LCase("master") Then ' do nothing Else If LCase(wks.Name) = LCase("employee census") Then ' do nothing Else If LCase(wks.Name) = LCase("vac&sick") Then ' do nothing Else ' Determine if the employee uses the first of the year or not If ActiveSheet.Range("C5").Value DateSerial(2005, 1, 1) Then ' if they do then do the copy/move If Range("A99").Value 0 Then Range("A7:F34").Select Selection.Copy ActiveWindow.SmallScroll Down:=66 Range("A100").Select ActiveSheet.Paste ActiveWindow.SmallScroll Down:=-75 Range("A8:F34").Select Application.CutCopyMode = False Selection.ClearContents Range("A99").Value = 1 End If Else ' if not then determine if the copy should be done or not If ActiveSheet.Range("C5").Value DateSerial(Now - 1, Range("C5"), Range("C5")) Then If Range("A99").Value 0 Then Range("A7:F34").Select Selection.Copy ActiveWindow.SmallScroll Down:=66 Range("A100").Select ActiveSheet.Paste ActiveWindow.SmallScroll Down:=-75 Range("A8:F34").Select Application.CutCopyMode = False Selection.ClearContents Range("A99").Value = 1 End If End If End If End If End If End If Next wks End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro not working correctly | Excel Discussion (Misc queries) | |||
VLookup is not working correctly | Excel Worksheet Functions | |||
Hyperlink not working correctly | Excel Discussion (Misc queries) | |||
Formulas not working correctly | Excel Worksheet Functions | |||
How to write this correctly? | Excel Programming |