Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7804487
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T01:55:53+00:00 2026-06-02T01:55:53+00:00

The setup: I have an excel doc with a form for entering data, the

  • 0

The setup:
I have an excel doc with a form for entering data, the data for that form is entered in a table to allow for easy entering of multiple rows of data. At least i thought so.

So right now i am trying to select the table to insert its data in the appropriate places. My question, i think, is this: do i select one table row at a time, or the whole table and deal with each row separately. And how do i do that?

I tried Sheets("Form").Range("dataForm[#ALL]").Select and several variations thereof and none worked.

If i select the table as a whole i need to be able to deal with each row seperately and if i select each row individually i need to be able to be able to start at the top of the table as the data must be in order.

Any ideas?

EDit: To add detail.
I have a form as stated above and its data must be inserted in different tables dependent on the value of certain cells in the form. For ease of discussion we will name that cell type, it has three possible values, as defined in a dropdown. Those values are income, expense and transfer. Based on those values we decide which table to add the data to. Income to the income table expense to the expense, etc.

So what i am trying to do is select as many rows as there are and insert each one into the correct table. The sorting is slightly more complicated than i have explained but if i can figure out the initial sort then it should be simple to sort it a few more times.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T01:55:54+00:00Added an answer on June 2, 2026 at 1:55 am

    This should help answer your questions.

    Sub TableStuff()
    Dim lo As Excel.ListObject
    Dim loRow As Excel.ListRow
    Dim i As Long
    
    Set lo = ActiveSheet.ListObjects(1)
    With lo
    'this is the address of the whole table
    Debug.Print .Range.Address
        For i = 1 To 10
            Set loRow = .ListRows.Add(i)
            loRow.Range.Cells(1).Value = "test" & i
        Next i
    Debug.Print .Range.Address
    'address of data rows
    Debug.Print .DataBodyRange.Address
    End With
    End Sub
    

    I have two posts on my blog about tables. A recent one might also provide some insights.

    EDIT: Based on comments below and edit to OP:

    This assumes two tables on Activesheet, tblSource and tblIncome. It filters the source table to Income, copies copies the visible rows and inserts them at the end of tblIncome. Finally, it deletes the source rows (all but one).

    You’ll want to add a loop to have it work for the other two categories:

    Sub MoveTableStuff()
    Dim loSource As Excel.ListObject
    Dim loTarget As Excel.ListObject
    Dim SourceDataRowsCount As Long
    Dim TargetDataRowsCount As Long
    
    Set loSource = ActiveSheet.ListObjects("tblSource")
    Set loTarget = ActiveSheet.ListObjects("tblIncome")
    With loSource
        .Range.AutoFilter Field:=1, Criteria1:="income"
        SourceDataRowsCount = .ListColumns(1).DataBodyRange.SpecialCells(xlCellTypeVisible).Count
    End With
    With loTarget
        TargetDataRowsCount = .DataBodyRange.Rows.Count
        .Resize .Range.Resize(.Range.Rows.Count + SourceDataRowsCount, .Range.Columns.Count)
        loSource.DataBodyRange.SpecialCells(xlCellTypeVisible).Copy
        .DataBodyRange.Cells(TargetDataRowsCount + 1, 1).PasteSpecial (xlPasteValues)
        Application.CutCopyMode = False
    End With
    With loSource
        .Range.AutoFilter
        .DataBodyRange.Offset(1).Resize(.DataBodyRange.Rows.Count - 1, .DataBodyRange.Columns.Count).Rows.Delete
    End With
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have setup a Symfony 2 Data Transformer that will allow the user to
I have an object that reads data from an Excel file using, which takes
Setup I have a website that draws RSS feeds and displays them on the
Setup: I have a COM DLL that calls a method inside a managed C#
I have a question about Excel! I hope that isn't too unconventional for this
We have over 800 MB of test case resource files that are Excel format.
We have an application that is built with Excel as the front end using
I have been asked to develop a system that collects data from a Sql
I've made a asp.net page that creates an Excel workbook. I have set the
Hi, I've got a slightly complicated setup of data ranges, which arrive in Excel

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.