Beginner VBA user here.
I'm getting a runtime error that says "Out of Memory" with one certain set of code. I have one specific worksheet within a workbook that contains 4 rows each valued as the days Monday, Tuesday, Wednesday, Thursday respectively in Column "A". The nature of the worksheet will add or remove rows between each "Day Named" Row throughout its use. Because of that, I have been trying to develop code that will keep track of which row each "Day Named" Row is so that a user form (which will be used to generate the aforementioned new rows) can use their location as reference.
Here is my code segment for that specific part:
Dim MondayCell As Long
Dim TuesdayCell As Long
Dim WednesdayCell As Long
Dim ThursdayCell As Long
Dim autosht As Worksheet
Set autosht = ThisWorkbook.Worksheets("AutoWISR")
With autosht
MondayCell = .Cells(.Rows.Value = "Monday", "A")
TuesdayCell = .Cells(.Rows.Value = "Tuesday", "A")
WednesdayCell = .Cells(.Rows.Value = "Wednesday", "A")
ThursdayCell = .Cells(.Rows.Value = "Thursday", "A")
End With
As soon as "MondayCell" is defined, I get the runtime error stating "Out of Memory". Can anyone tell me what the issue is and how to free up memory for processing?
Thanks.
I'm getting a runtime error that says "Out of Memory" with one certain set of code. I have one specific worksheet within a workbook that contains 4 rows each valued as the days Monday, Tuesday, Wednesday, Thursday respectively in Column "A". The nature of the worksheet will add or remove rows between each "Day Named" Row throughout its use. Because of that, I have been trying to develop code that will keep track of which row each "Day Named" Row is so that a user form (which will be used to generate the aforementioned new rows) can use their location as reference.
Here is my code segment for that specific part:
Dim MondayCell As Long
Dim TuesdayCell As Long
Dim WednesdayCell As Long
Dim ThursdayCell As Long
Dim autosht As Worksheet
Set autosht = ThisWorkbook.Worksheets("AutoWISR")
With autosht
MondayCell = .Cells(.Rows.Value = "Monday", "A")
TuesdayCell = .Cells(.Rows.Value = "Tuesday", "A")
WednesdayCell = .Cells(.Rows.Value = "Wednesday", "A")
ThursdayCell = .Cells(.Rows.Value = "Thursday", "A")
End With
As soon as "MondayCell" is defined, I get the runtime error stating "Out of Memory". Can anyone tell me what the issue is and how to free up memory for processing?
Thanks.