Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
dim ws as worksheet
for each ws in thisworkbook.worksheets
next
[/ignore]
[code]
Sub processthisbook()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
select case left(ws.Name, 1)
Case "a"
Call macro1
Case "b"
Call macro2
Case Else
Exit Sub 'do you REALLY want to bail out or just let the For...Next finish??????
End select
Next ws
End Sub
Sub processthisbook1()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
Select Case Left(ws.Name, 1)
Case "a"
Call macro1 ws
Case "b"
Call macro2 ws
End Select
Next ws
End Sub
Sub macro1(ws As Worksheet)
Dim strBcell As Date
Dim OBcell As Range
strBcell = Worksheets("Data").Range("a1")
Set OBcell = ws.Rows("1").Find(what:=strBcell)
ws.Range(OBcell.Offset(1, 0), OBcell.Offset(35, 0)).Value = ws.Range("b2:b35").Value
End Sub
Sub macro2(ws As Worksheet)
Dim strCcell As Date
Dim OCcell As Range
strCcell = Worksheets("Data").Range("a1")
Set OCcell = ws.Rows("1").Find(what:=strCcell)
ws.Range(OCcell.Offset(1, 0), OCcell.Offset(35, 0)).Value = ws.Range("c2:c35").Value
End Sub
Sub processthisbook1()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
Select Case Left(ws.Name, 1)
Case "a", "b"
Call NEWmacro ws
End Select
Next ws
End Sub
Sub NEWmacro(ws As Worksheet)
Dim strBcell As Date
Dim OBcell As Range, sRng as string
strBcell = Worksheets("Data").Range("a1")
with ws
Set OBcell = .Rows("1").Find(what:=strBcell)
select case Left(.name, 1)
case "a"
srng = "a2:a35"
case "b"
srng = "b2:b35"
end select
.Range(OBcell.Offset(1, 0), OBcell.Offset(35, 0)).Value = .Range(srng).Value
end with
End Sub