This first method wont work, give me and 400 Error code
Worksheets("RELAT").Range(Cells(i, 3), Cells(i + 1, 12)).Value = Worksheets(mes).Range("P5:Y6").Value
This second method work fine
Worksheets("RELAT").Range("C7:L8").Value = Worksheets(mes).Range("P5:Y6").Value
First and second methos isn't the same thing ? whats wrong ?
Complete code:
Sub atualizar_Relatorio()
Dim i As Integer
Dim j As Integer
Dim mes As String
j = 1
For i = 7 To 30 Step 2
mes = ActiveSheet.Cells(i, j).Value 'get a month name
MsgBox (mes & " " & i) 'testing the month name (sheet name)
Worksheets("RELAT").Range(Cells(i, 3), Cells(i + 1, 12)).Value = Worksheets(mes).Range("P5:Y6").Value
Worksheets("RELAT").Range("C7:L8").Value = Worksheets(mes).Range("P5:Y6").Value
Next i
End Sub
I trying to copy one Worksheet Range and paste a range to a new sheet using cells methos to jump the lines, i can do this using Range reference (write many lines to refer a many ranges), but if i try reference using cells i receive an 400 error