Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

formattig excel from access

Posted on 2016-11-24
3
Medium Priority
?
57 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 35

Accepted Solution

by:
Norie earned 2000 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 27

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

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

650 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