Consulting

Results 1 to 2 of 2

Thread: Delete Rows based on Input Box Enrty

  1. #1

    Delete Rows based on Input Box Enrty

    Hello All. I'm new to this forum and have a limited knowledge of writing VBA but I'm looking to change that.

    In the attached sheet I would like to delete any rows where the results from the input box are not equal to the value in column "O".

    I tried to use the following code but I'm getting the Error: Invalid or Unqualified Reference.

    Sub BatchID()


    'Declare Variable
    Dim BatchID As String
    'Get String from Input Box
    InputBox ("Enter the batch id you need ")
    'Delete any row where BatchId is <> value in Column ("O1 to end)
    If BatchID <> Range("O:O") Then .Delete.EntireRow



    End Sub

    Any help on this would be greatly appreciated.

    Thanks.
    Attached Files Attached Files

  2. #2
    VBAX Regular
    Joined
    Jan 2018
    Location
    The Netherlands
    Posts
    45
    Location
    Ok, first count the rows you have and then setup a loop to seacrh into the kolom for that value try this first. So you Will learn Vba. Show us the results

Posting Permissions

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