How to designate a range using last used cell in a column as starting point Foru
ID: 640622 • Letter: H
Question
How to designate a range using last used cell in a column as starting point
Forum members
I have been trying to write a vba macro code line that designates a range of cells beyond a used range.
Before I copy/paste a set of data to an existing data base I like to clear the designated location where I intend to paste.
I use
LastRow = Sheets("SrchNonDups4FrthrProc").Cells(Cells.Rows.Count, "f").End(xlUp).Row
lrw = LastRow or fccell = lrw +1
to determine the last row and lrw +1 to designate the start cell in the range I want to clear.
For example using lrw +1 as the first cell in the range I wish to clear, the code I have been trying to use is, range("a & lrw +1:u9000").select and then selection.clear. I have tried many variations of this but none work.
Obviously I could simply paste to cell range("a" & lrw +1") and I know this would work by overwriting what might already be there but I have reasons for trying to do it the way I have described.
Can any of you experts out there help me on this one? Your help is appreciated in advance !!
Explanation / Answer
Hi..
Try
Sheets("SrchNonDups4FrthrProc").Range("A" & (lrw + 1) & ":U9000").Clear
or
With Sheets("SrchNonDups4FrthrProc")
.Range("A" & (lrw + 1) & ":U" & .Rows.Count).Clear
End With
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.