Solved

formattig excel from access

Posted on 2016-11-24
3
17 Views
Last Modified: 2016-11-24
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?
0
Comment
Question by:drtopserv
3 Comments
 
LVL 33

Accepted Solution

by:
Norie earned 500 total points
ID: 41900197
Does it work if you change the paste destination to the top left cell?
      xlSheet.range("E7").PasteSpecial Paste:=-4163, Operation:=-4142, SkipBlanks:=True

Open in new window

0
 
LVL 26

Expert Comment

by:MacroShadow
ID: 41900201
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

0
 

Author Closing Comment

by:drtopserv
ID: 41900233
Great , works!
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now