+ Reply to Thread
Results 1 to 5 of 5

Needing help with a vba that will delete a row

  1. #1
    Registered User
    Join Date
    03-20-2015
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2010
    Posts
    7

    Question Needing help with a vba that will delete a row

    Hey guys,
    So essentially I have used this code to be able to add a row in a specific place on my sheet. What I'm needing help with is creating a vba similar to this to DELETE a row. This is what I used to create a row. Any help would be great regarding how I can create one with a similar stuff (like the user being able to type in a specific row number) Thanks!

    Sub AddARow()
    Dim varUserInput As Variant
    varUserInput = InputBox("Enter Row Number where you want to add a row:", _
    "What Row?")
    If varUserInput = "" Then Exit Sub

    RowNum = varUserInput
    Rows(RowNum & ":" & RowNum).Insert Shift:=xlDown
    Rows(RowNum - 1 & ":" & RowNum - 1).Copy Range("A" & RowNum)
    Range(RowNum & ":" & RowNum).ClearContents
    End Sub

  2. #2
    Registered User
    Join Date
    03-20-2015
    Location
    Switzerland
    MS-Off Ver
    2013
    Posts
    7

    Re: Needing help with a vba that will delete a row

    Hi to the forum

    I would maybe advise you to try this macro

    It will delete a line that contains "whatever"

    hope this helps

    Choupi
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    03-20-2015
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Needing help with a vba that will delete a row

    Hi,
    thanks for the suggestion but its customer records so the words on a row will always be different

  4. #4
    Forum Contributor
    Join Date
    07-24-2009
    Location
    Valrico, FL USA
    MS-Off Ver
    Excel 2016
    Posts
    358

    Re: Needing help with a vba that will delete a row

    The code below will delete the row input by the user.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    03-20-2015
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Needing help with a vba that will delete a row

    Thanks so much! Exactly what I was looking for!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. needing macro to delete cells that only contain text
    By codelphi in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-20-2014, 08:56 PM
  2. needing an if and an and
    By badger111 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 12-05-2008, 07:11 PM
  3. [SOLVED] Needing Help Very Bad
    By Mike in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-19-2006, 02:25 AM
  4. [SOLVED] needing some If Range value
    By Johnny Mick in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-23-2006, 05:40 PM
  5. Needing your help again.
    By sungen99 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-09-2005, 12:49 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1