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 8091553
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:05:29+00:00 2026-06-05T20:05:29+00:00

I am trying to write a VBA scriptin Microsoft Access that will interface with

  • 0

I am trying to write a VBA scriptin Microsoft Access that will interface with an Excel sheet, loop through rows and then cells in the row, and then pull info back into the Access table.

Here is some sudo code-

For Each Row
    For Each Cell in the Row
        Read the Cell
        Create a new Record in the Access table with the info from the cell
    End For Each
End For Each

You can see a simplified example of the end result in the pictures below.

What we have-

enter image description here

What is needed-

enter image description here

I have coded before, but never in VBA; so any help would be appreciated! Thanks for your help!!!

  • 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-05T20:05:30+00:00Added an answer on June 5, 2026 at 8:05 pm

    First create a link to your Excel worksheet as @Remou suggested. In the following example, I named the link as “tblExcelData”. Then “tblDestination” will store a separate record for each “cell” of a worksheet row as you requested. In tblDestination, Seq# is long integer, and Field Name and Field Value are both text.

    Public Sub foo20120612a()
        Dim db As DAO.Database
        Dim rsSrc As DAO.Recordset
        Dim rsDest As DAO.Recordset
        Dim fld As DAO.Field
    
        Set db = CurrentDb
        Set rsSrc = db.OpenRecordset("tblExcelData", dbOpenSnapshot)
        Set rsDest = db.OpenRecordset("tblDestination", _
            dbOpenTable, dbAppendOnly)
        Do While Not rsSrc.EOF
            For Each fld In rsSrc.Fields
                If fld.Name <> "Seq#" Then
                    With rsDest
                        .AddNew
                        ![Seq#] = CLng(rsSrc![Seq#])
                        ![Field Name] = fld.Name
                        ![Field Value] = fld.value
                        .Update
                    End With
                End If
            Next fld
            rsSrc.MoveNext
        Loop
        rsDest.Close
        Set rsDest = Nothing
        rsSrc.Close
        Set rsSrc = Nothing
        Set db = Nothing
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to write VBA code which works on my Excel sheet. Range(A65536).End(xlUp).Row
I'm trying to write a VBA macro in Word that will extract shapes and
I am trying to write a function for excel 2010 that will take a
I' trying to write an xml file from Excel VBA using Microsoft XML 6.0.
I am trying to write VBA code that will select a named range, copy
I'm trying to write a VBA function in Access that replaces words in an
I'm trying to write a VBA function that restricts its inputs. It takes three
I am trying to write an excel macro/VBA code to adjust a column's contents
Trying to write app for service technicians that will display open service calls within
Trying to write a couple of functions that will encrypt or decrypt a file

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.