View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
mangesh_yadav[_224_] mangesh_yadav[_224_] is offline
external usenet poster
 
Posts: 1
Default Do..Loop in multi sheets


Add the following line
sh.Select
after line 2 in your second sub.

It should be

Sub Sub_total2l()
For Each sh In ActiveWorkbook.Worksheets
sh.Select
With sh
.Range("J2").Select
Do While IsEmpty(ActiveCell.Offset(0, -6)) = False
ActiveCell.FormulaR1C1 = _
"=IF(RC[-8]<R[1]C[-8],SUMIF(R2C[-8]:RC[-8],RC[-8],R2C[-1]:RC[-1]),"""")"
ActiveCell.Offset(1, 0).Select
Loop
End With
Next sh
End Sub



Manges

--
mangesh_yada
-----------------------------------------------------------------------
mangesh_yadav's Profile: http://www.excelforum.com/member.php...fo&userid=1047
View this thread: http://www.excelforum.com/showthread.php?threadid=37411