Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro
Hello from Steved
The below macro worked only one time I need to work each time the worksheet is changed. What is needed to get this to work please. thankyou Private Sub Worksheet_Change(ByVal Target As Excel.Range) If Application.CountIf(Cells, "TOTAL SHIFT HOURS") Then Application.EnableEvents = False Const sFIND As String = "TOTAL SHIFT HOURS" Dim vArr As Variant Dim rFound As Range Dim nCount As Long vArr = Array ("City", "Roskill", "Papakura", "Wiri", "Shore", "Orewa", "Swanson") nCount = 0 Set rFound = Cells.Find( _ What:=sFIND, _ LookIn:=xlValues, _ LookAt:=xlPart, _ SearchOrder:=xlByColumns, _ SearchDirection:=xlNext, _ MatchCase:=False) Do While Not rFound Is Nothing And nCount <= UBound (vArr) rFound.Value = vArr(nCount) nCount = nCount + 1 Set rFound = Cells.FindNext(after:=rFound) Loop End If End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro recorded... tabs & file names changed, macro hangs | Excel Worksheet Functions | |||
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort | Excel Worksheet Functions | |||
macro to delete entire rows when column A is blank ...a quick macro | Excel Programming | |||
Start Macro / Stop Macro / Restart Macro | Excel Programming |