Hi there- I've been trying to get this Macro to work for some time now and I cannot figure out the problem. It doesn't cycle through the worksheets like it should, instead it stays on the same worksheet and the code repeats itself. The purpose of this code was to cycle through the worksheets in the workbook and apply the same macro to them. I'm using the LoopThroughSheet Macro to call Merge_WIW. Please help.
Sub LoopThroughSheet()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
Call Merge_WIW
On Error Resume Next 'Will continue if an error results
ws.Range("A1") = ws.Name
Next ws
End Sub
Sub Merge_WIW()
Dim LastRow As Long
Dim lRow As Long
Cells.Select
Selection.EntireRow.Hidden = False
Columns("B:B").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Range("B1").Select
ActiveCell.FormulaR1C1 = "Concatenate"
With ActiveCell.Characters(Start:=1, Length:=11).Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 1
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
Range("B2").Select
ActiveCell.FormulaR1C1 = _
"=CONCATENATE(TEXT(RC[13],""m/dd/yyyy""),"" "",""("",RC[16],"")"")"
' Find the last filled row in column A
lRow = Cells(Rows.Count, 1).End(xlUp).Row
' Fill from B2 to last row of data from Column A.
Range("B2").Select
Selection.AutoFill Destination:=Range("B2:B" & Range("A1000000").End(xlUp).Row), Type:=xlFillDefault
End Sub
Bookmarks