Link to home
Start Free TrialLog in
Avatar of drtopserv
drtopservFlag for Israel

asked on

formattig excel from access

Hi
I am using this code from access vba that apply format column from 1 excel to another :

xlsheet2.range("E7:E50000").Copy
Set xlSheet = xlBook.Sheets(3)
        xlApp.Visible = True
        Set rsCurr = CurrentDb.QueryDefs("qtblSubtractedBiWeeklyReport").OpenRecordset
        xlSheet.range("A7").CopyFromRecordset rsCurr
        xlSheet.range("E7:E50000").PasteSpecial Paste:=-4163, Operation:=-4142, SkipBlanks:=True

i got pop-up massege that ask me to confirm OK :
"Data on the clipboard is not the same size and shape as the selected area. Do you want to paste the data anyway?"

How can i solve and cancel this massege?
ASKER CERTIFIED SOLUTION
Avatar of Norie
Norie

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Copy directly from the recordset to the desired destination.
        xlsheet2.range("E7:E50000").Copy
        Set xlSheet = xlBook.Sheets(3)
        xlApp.Visible = True
        Set rsCurr = CurrentDb.QueryDefs("qtblSubtractedBiWeeklyReport").OpenRecordset
        xlSheet.range("E7").CopyFromRecordset rsCurr
        ' xlSheet.range("E7:E50000").PasteSpecial Paste:=-4163, Operation:=-4142, SkipBlanks:=True

Open in new window

Avatar of drtopserv

ASKER

Great , works!