Results 1 to 6 of 6

Thread: vba code if lastrow is full, it errors out

  1. #1

    vba code if lastrow is full, it errors out

    i have userform with a vba code, the vba code its supposed to fill from inputbox 'boxestotal' into the next available empty cell within a range of cell on column d, but if cell D25 if full (first) then it detects it as entire D5 to D25 full, (altho there are empty cellss in between.
    attached is a sample workbook. Please help, thanks in advance

    PS. I used D25 to fill some data first sometimes.
    Attached Files Attached Files
    Last edited by chubbychub; 01-21-2023 at 05:35 PM.

  2. #2
    you test this one.
    Attached Files Attached Files

  3. #3
    In your code you have "GetLastCell"
    That looks like a UDF but I can't find it.
    Did you forget to copy/paste that?

  4. #4
    Moderator VBAX Sage SamT's Avatar
    Oct 2006
    Near Columbia
    Next empty cell = Cells(5, "D").End(xlDown)
    I expect the student to do their homework and find all the errrors I leeve in.

    Please take the time to read the Forum FAQ

  5. #5
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Oct 2005
    Surrey UK
    Instead of:
    Set rng = GetLastCell(Range("D5:D26"), xlByRows)
    Set rng = Range("D5:D26").SpecialCells(xlCellTypeBlanks).Cells(1)
    or qualified a bit:
    Set rng = Sheets("Sheet1").Range("D5:D26").SpecialCells(xlCellTypeBlanks).Cells(1)
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  6. #6
    the post by arnelgp provided the solution and it works.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts