Im struggling to find the issue with my code as it gives me a Run-time error 1004: Application defined or Object defined error
. I want to set the value of cell B5 in the sheet titled 'Design' to 34. My code is shown below
Public Sub test()
Dim book1 As Workbook, recordsht As Worksheet, m As Integer
Set book1 = Application.Workbooks("planning design 2.xlsm")
Set recordsht = book1.Worksheets("Records")
m = 5
recordsht.Range(Cells(m, "B"), Cells(m, "B")).Value = 34
End Sub
The value of m
is variable hence why I want to use the Range.Cells method.