Hi,
I have a piece of code which works with defined specific sheet name (of course it does not do exactly what I need but it`s correct from syntax point of view) but when I try to define the sheet name where I need to paste the range selected as variable "i" I get a compile error - it`s the line in red.
any idea how to fix it please?
I have a piece of code which works with defined specific sheet name (of course it does not do exactly what I need but it`s correct from syntax point of view) but when I try to define the sheet name where I need to paste the range selected as variable "i" I get a compile error - it`s the line in red.
any idea how to fix it please?
VBA Code:
Dim LR As Integer, i As Integer
Application.ScreenUpdating = False
With Sheets("DED")
LR = .Range("A" & Rows.Count).End(xlUp).Row
For i = 1 To LR
Sheets("Template").Copy After:=Sheets("Template")
ActiveSheet.Name = .Range("A" & i).Value
Range("B4").Value = .Range("A" & i).Value
Sheets("pivot").Select
Columns("A:A").Select
Selection.Find(What:=.i, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.Offset(1, 0).Select
Dim AC As Range
Dim LC As Range
Set AC = ActiveCell
Do Until ActiveCell.Offset(1, 0) = blank
ActiveCell.Offset(1, 0).Select
Loop
Set LC = ActiveCell.Offset(0, 5)
[COLOR=rgb(226, 80, 65)]Range(AC, LC).Copy Destination:=Worksheets.i.Range("B9")[/COLOR]
Next i
End With