Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The following code calculate on all sheets in a workbook named _Balances. I
want to do another calculation on other sheets named _Code. How do I add that to the code. For other sheets named _Code, I want to add cell g36 to cell g23. Sub T_Balances() Dim ws As Worksheet Application.ScreenUpdating = False For Each ws In Worksheets If InStr(1, ws.Name, "_Balances") Then With ws ..Range("g35").Value = .Range("g40").Value With .Range("g23") formStr = .Formula ..Formula = formStr & "+" & ws.Range("g36").Value End With With .Range("g30") formStr = .Formula ..Formula = formStr & "+" & ws.Range("g57").Value End with End With End If Help me in putting this code in one, so that it does calculation on multiple sheets while putting into consideration different names. Thanks "Yossy" wrote: The following code calculate on all sheets in a workbook named _Trial. I want to do another calculation on other sheets named _Code. How do I add that to the code. For other sheets named _Code, I want to add cell g36 to cell g23. Sub T_Balances() Dim ws As Worksheet Application.ScreenUpdating = False For Each ws In Worksheets If InStr(1, ws.Name, "_Balances") Then With ws .Range("g35").Value = .Range("g40").Value With .Range("g23") formStr = .Formula .Formula = formStr & "+" & ws.Range("g36").Value End With With .Range("g30") formStr = .Formula .Formula = formStr & "+" & ws.Range("g57").Value End with End With End If Help me in putting this code in one, so that it does calculation on multiple sheets while putting into consideration different names. Thanks |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
split post code (zip code) out of cell that includes full address | Excel Discussion (Misc queries) | |||
Run VBA code only worksheet change, but don't trigger worksheet_change event based on what the code does | Excel Programming | |||
Shorten code to apply to all sheets except a few, instead of individually naming them, and later adding to code. | Excel Programming | |||
Protect Sheet with code, but then code will not Paste error. How do i get around this. Please read for explainations.... | Excel Programming | |||
Excel code convert to Access code - Concat & eliminate duplicates | Excel Programming |