Hi, this one has had me running round in circles for a bit tonight:banghead:
I'm copying multiple ranges of cells from excel into access and it works fine EXCEPT two of the columns, k and l are calculated. K is a summation of 5 columns i.e a1+b1+c1 etc and L is a date calculation, a specific cell displays a date and each cell in column L adds 7 to it (this is necessary for when exported to Access).
I need to copy the values only from columns K and L, as it stands I'm getting only the first cell in each row for column K and a date set in 1900 for column L.
I've tried lots of options but getting nowhere so please help if you can.
Here's the code:
Thanks, Lol
I'm copying multiple ranges of cells from excel into access and it works fine EXCEPT two of the columns, k and l are calculated. K is a summation of 5 columns i.e a1+b1+c1 etc and L is a date calculation, a specific cell displays a date and each cell in column L adds 7 to it (this is necessary for when exported to Access).
I need to copy the values only from columns K and L, as it stands I'm getting only the first cell in each row for column K and a date set in 1900 for column L.
I've tried lots of options but getting nowhere so please help if you can.
Here's the code:
Code:
Sub Button1_Click()
Const acCmdPasteAppend = 38
Sheets("June 12th").Select
Range("a5:a30, b5:b30, c5:c30, k5:k30, l5:l30").Select
Selection.Copy
strDBName = "Data Export Trial.accdb"
strMyPath = "c:\Users\Lol\Desktop"
strDB = strMyPath & "\" & strDBName
Set appAccess = CreateObject("Access.Application")
' Open database in Microsoft Access window.
appAccess.OpenCurrentDatabase strDB
appAccess.Visible = True
appAccess.DoCmd.OpenTable "Tbl_Trial", acViewNormal, acEdit
appAccess.DoCmd.RunCommand acCmdPasteAppend
appAccess.CloseCurrentDatabase
appAccess.Quit acQuitSaveAll
End Sub
Thanks, Lol