I have a code in VB:
srcClm2 = Sheet45.Range("B2:B" & lastRowSrc)
But I wanna choose sheet by name. I try the different ways, for example:
Sheets("Cycle").Range("A2:A" & lastRowSrc)
But I have got error: "Type mismatch."
EDIT: This is fragment of my code:
Dim srcClm1(), srcClm2()
Dim lastRowSrc As Long
lastRowSrc = Sheets("Line_Cycle_working_sheet").Cells(Rows.Count, 1).End(xlUp).Row
srcClm1 = Sheets("Line_Cycle_working_sheet").Range("A2:A" & lastRowSrc)
srcClm2 = Sheets("Line_Cycle_working_sheet").Range("B2:B" & lastRowSrc)
Sheets("Cycle").Range("A2:A" & lastRowSrc)
is right.Sheets("Cycle").Range("A2:A" & lastRowSrc)
is correct as long as 1. your active workbook contains a sheet "Cycle", and 2. lastRowSrc is a number >0. Also, don't forgetSet
inSet srcClm2 = ...