+ Reply to Thread
Results 1 to 10 of 10

How to write reference to Table in vba

  1. #1
    Registered User
    Join Date
    05-29-2012
    Location
    Wilmingotn DE USA
    MS-Off Ver
    Excel 2016
    Posts
    67

    Question How to write reference to Table in vba

    Dear Sirs
    I have a problem to write reference to Table.
    Normally with a range I would write looping "For Next" like that:
    Please Login or Register  to view this content.
    how to write it if I need to check rows in Table1
    I tried things like: for i=1 to Table1.rows.count and many similar comibnations and nothing works.
    I means for me I need to get educated in this field. Please help

    MODERATOR COMMENT: Code Tags added. Please use them in the future.
    Last edited by alansidman; 06-25-2020 at 11:58 AM.

  2. #2
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,713

    Re: How to write reference to Table in vba

    Hi Flowerski,

    Try something like below ... By the way, if you're working with tables & VBA, I think you can click HERE for more details

    Please Login or Register  to view this content.
    Last edited by nankw83; 06-25-2020 at 03:26 PM. Reason: Added a link
    If I was able to help, you can thank me by clicking the * Add Reputation under my user name

  3. #3
    Registered User
    Join Date
    05-29-2012
    Location
    Wilmingotn DE USA
    MS-Off Ver
    Excel 2016
    Posts
    67

    Re: How to write reference to Table in vba

    Thanks. Your respond is helpful. THanks for valuable link.
    What it is Code Tag? Moderator asked me to use it. What is that?

  4. #4
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,713

    Re: How to write reference to Table in vba

    Glad I could help. Regarding code tags, when you post any VBA code it is easier for the forum members to read so you've been asked to insert the code tags which creates the box that you see my post where the code is located in. Easiest way to do it is select the code you have then click # & it will insert it for you. You can read more about it HERE

    If the provided solution takes care of your original question, please mark this thread as 'SOLVED' from the Thread Tools at the top menu & consider adding Reputations to those who have helped by clicking the star under their usernames

  5. #5
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,973

    Re: How to write reference to Table in vba

    FYI - You can also refer to table in following manner.
    Please Login or Register  to view this content.
    Though in general, I'd go with nankw83's approach of using ListObjects().

    This will allow you to access methods and properties that belongs to ListObject. Ex: DataBodyRange, ListRows.Add, Resize etc

    Edit: Note that 1 is used to start from first data. Use 0 to start from Header row.
    "Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something."
    ― Robert A. Heinlein

  6. #6
    Registered User
    Join Date
    05-29-2012
    Location
    Wilmingotn DE USA
    MS-Off Ver
    Excel 2016
    Posts
    67

    Re: How to write reference to Table in vba

    Thank you very much

  7. #7
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,973

    Re: How to write reference to Table in vba

    You are welcome and thanks for the rep.

  8. #8
    Registered User
    Join Date
    05-29-2012
    Location
    Wilmingotn DE USA
    MS-Off Ver
    Excel 2016
    Posts
    67

    Re: How to write reference to Table in vba

    Dear nankw83, I have read the link which supposed to explain me what is Code Tag. I still do not get it. Maybe one day I will understand. Thanks anyway.

  9. #9
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,973

    Re: How to write reference to Table in vba

    Code tag is used to block code into more readable format separate from normal text.
    [Code] is used before the code and [/Code] after the code.

    This can be done by selecting your VBA code string, then pressing "#" button found at top section of text editor area.


    0.JPG

  10. #10
    Registered User
    Join Date
    05-29-2012
    Location
    Wilmingotn DE USA
    MS-Off Ver
    Excel 2016
    Posts
    67

    Re: How to write reference to Table in vba

    Thanks, hopefully I will remember that. Take care

+ 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. How to write VBA code to clear a table but preserve table and 1 empty row
    By kwoltman in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 03-28-2019, 07:26 PM
  2. Write back to table source from a resorted table on another worksheet
    By fuadramsey in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-17-2018, 07:42 PM
  3. how to write text with reference fields
    By livelymind in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-24-2013, 07:00 AM
  4. How to write in Word w/o Reference
    By Gérard Ducouret in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-07-2006, 10:10 AM
  5. [SOLVED] How to write in Word w/o Reference
    By Gérard Ducouret in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-07-2006, 07:15 AM
  6. How do I write macros with relative reference cells
    By trilogylynch in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-25-2005, 05:05 PM
  7. [SOLVED] Looking for documentation/reference to write Excel Macro
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-11-2005, 02:06 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