Very new to VBA for excel.
I'm trying to put values from one sheet into another sheet. I've scoured the internet for solutions, and nothing has worked. Every time I get a 1004 Error: Application-defined error.
This is going to be part of a bigger program, but I can't even move past this step.
My goal is to make a Macro that will go through each sheet in the workbook as listed in the first column of the Masterlist. Within each sheet, the macro should look two different columns for the items listed in the second column of the Masterlist and replace it with the items corresponding replacement.
My code is below. The lines of code are commented out and labelled which do and don't work.
I was trying to get the value from Masterlist A2 into Output A2. Everything except the line labelled as correct will get an error, but I need this to function with integer variables eventually.
Sub Test()
Dim Masterlist As Worksheet
Dim Output As Worksheet
Set Masterlist = ThisWorkbook.Worksheets("Masterlist")
Set Output = ThisWorkbook.Worksheets("Output")
'This works: Sheets("Output").Range("A2").Value = Sheets("Masterlist").Range("A2").Value
'These don't work:
' Output.Cells(1, 0).Value = Masterlist.Cells(1, 0).Value
' Sheets("Output").Offset(1).Range("A1").Value = Sheets("Masterlist").Offset(1).Range("A1").Value
End Sub
I get the same error when trying to use the expression below
IsEmpty(Sheets("Masterlist").Cells(DateRow, 1))
Range("A2")is the equivalent ofCells(2,1)(numbering of rows and columns starts at1, not0)Sheets("Output").Offset(1)worksheets do not have anOffsetmethod, only Ranges have that.