Getting an Out Of Memory Error with excel VBA with a simple line of code that has always worked until now.
Dim lRow, lCol, rowCount, totalRows As Long
Dim tblRng, vLookup, vLookup2, vLookup3 As Range
Dim wb As Workbook
Dim ws As Worksheet
Dim branch, position, branchName, seniorLu, region, branchNum As Variant
Range("B2").Cut Range("C2")
Columns("C:C").Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
lRow = Cells(Rows.Count, 1).End(xlUp).Row '<---- this line is the error
lCol = Cells(1, Columns.Count).End(xlToLeft).Column
Not sure why this seemingly simple line of code would be throwing the out of memory error. It has worked every week for over a year until just now.
Any thoughts are greatly appreciated
Dim lRow As Long, lCol As Long, rowCount As Long, totalRows As Long. You need to repeat the type for each variable. Though I'm surprised you're getting an Out of Memory error for an implicitVariant. Something else may be going on.