0% found this document useful (0 votes)
2 views1 page

Excel Data Import to Access VBA

Uploaded by

Atif Trags
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

Excel Data Import to Access VBA

Uploaded by

Atif Trags
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Sub DataToAccess()

Dim db As database
Dim rs As Recordset
Dim cell As Variant

Set tblcount = 0
Set db = workspaces(0).OpenDatabase(“C:[Link]”)
Set rs = [Link](“tblTable”, dbOpenDynaset)

‘here you select your excel data


Range(Cells(4, 1), Cells(4, 1).End(xlDown)).Select

For Each cell In Selection


With rs
.AddNew
!Field1 = Range(“$B$1”).Text
!Field2 = [Link]
!Feield3 = [Link](0, 1).Text
.Update
End With
Next

Set rs = Nothing
Set db = Nothing

End Sub

You might also like