+ Reply to Thread
Results 1 to 5 of 5

How do I select a row in VB like this Activecell.rows but in a table

  1. #1
    Registered User
    Join Date
    07-15-2022
    Location
    Delta Canada
    MS-Off Ver
    365
    Posts
    73

    How do I select a row in VB like this Activecell.rows but in a table

    I have VBA that selects a row, but it is an entire row.
    I need it to select only the row INSIDE a table. "Table1"Chris Helper Add Row.xlsm
    Here is the line:

    'this inserts row but I need insert row INSIDE table only

    ActiveCell.Rows("1:" & Qty).EntireRow.Select


    Here is the entire code:

    Sub Insert()
    Qty = Range("L2").Value
    Range("A4").Select

    Thank you very much
    ActiveCell.Rows("1:" & Qty).EntireRow.Select


    Selection.Insert Shift:=xlDown
    ActiveCell.Select
    Range("A4").Resize(Qty, 4).Value = Range("H2:K2").Value

    End Sub

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: How do I select a row in VB like this Activecell.rows but in a table

    Hi chris,

    I find https://learn.microsoft.com/en-us/of...insertrowrange while searching for a good answer.

    I also think watching this may help solve your problem. https://www.youtube.com/watch?v=8fdsy1vSFJs&t=19s

    Does this help?
    Last edited by MarvinP; 05-25-2023 at 12:25 PM.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,528

    Re: How do I select a row in VB like this Activecell.rows but in a table

    Besides Marvin's solution,
    Insert Row Above Row 5
    Please Login or Register  to view this content.
    from here:
    https://www.thespreadsheetguru.com/b...t-excel-tables
    Experience trumps academics every day of the week and twice on Sunday.

  4. #4
    Registered User
    Join Date
    07-15-2022
    Location
    Delta Canada
    MS-Off Ver
    365
    Posts
    73

    Re: How do I select a row in VB like this Activecell.rows but in a table

    jolivanes
    I get this error:
    Attachment 830686


    error02.png

  5. #5
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,528

    Re: How do I select a row in VB like this Activecell.rows but in a table

    Did you read the article?

    One of the things mentioned is"
    Select Row 4 of Table Data
    Please Login or Register  to view this content.
    and not "Range("A4").Select"
    Read the article and if any more problems, come back to us. I am out the door right now so I can't do any more until back.
    Last edited by jolivanes; 05-25-2023 at 02:25 PM.

+ 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. Replies: 11
    Last Post: 04-19-2021, 07:46 PM
  2. difference in between activecell.activate and activecell.select
    By HaroonSid in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-08-2020, 03:14 AM
  3. [SOLVED] copy rows with activecell value and insert rows after activecell
    By a.hudrea in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-21-2014, 09:05 AM
  4. VBA select the entire Table row below ActiveCell
    By kaseyleigh in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-07-2014, 09:05 AM
  5. How to select activecell
    By excel_vb in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-02-2010, 03:17 AM
  6. select activecell and following
    By Armitage2k in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-07-2009, 08:07 AM
  7. [SOLVED] select range next to activecell
    By lookin in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-29-2006, 03:10 PM

Tags for this Thread

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