Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
I have a function in VBA as detailed at the end of my text and it is updating
all worksheets in a workbook rather than just the active one. I have 12 worksheets all identical apart from Column 2 which holds consecutive date data (hence one sheet per month). Cell A2 shows the current date on all worksheets. My cell formula on each worksheet is =addtimeb(C3:CN3,"H") which changes for each subsequent row for a number of rows ie =addtimeb(D3:DN3,"H") =addtimeb(E3:EN3,"H") =addtimeb(F3:FN3,"H") etc etc each row is an employee record. I am extracting and summing numbers, from string text fields, that follow a "H" (for holiday) and where column 2 has a date <= the current date (cell A2). However when I amendd ata on any sheet it automatically updates all sheets but only takes into account the dates in column 2 on the active sheet. Hence data held on the remaining 11 sheets becomes inaccurate. Function addtimeb(rng As Range, ltr As String) Application.Volatile Dim ts As String Dim x As Long Dim DateRow As Long ltr = UCase(ltr) For Each c In rng If Cells(2, c.Column).Value Range("A2").Value Then GoTo getmeout If InStr(UCase(c.Value), ltr) 0 Then For x = InStr(UCase(c.Value), ltr) To Len(c.Value) If IsNumeric(Mid(c.Value, x, 1)) Or Mid(c.Value, x, 1) = "." Then ts = ts + Mid(c.Value, x, 1) If Not IsNumeric(Mid(c.Value, x + 1, 1)) And _ Mid(c.Value, x + 1, 1) < "." Then Exit For End If Next End If If ts < "" Then addtimeb = addtimeb + Val(ts) ts = "" End If getmeout: Next End Function Thank you. -- PK wilts |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
SUM function across multiple worksheets within one workbook | Excel Worksheet Functions | |||
My workbook links are not updating (its 30,000 KB size workbook). | Excel Discussion (Misc queries) | |||
Auto updating a workbook with data from another workbook | Excel Discussion (Misc queries) | |||
Updating multiple worksheets in a large workbook | Excel Discussion (Misc queries) | |||
updating excel worksheets to another workbook | Excel Worksheet Functions |