Solved

formattig excel from access

Posted on 2016-11-24
3
45 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 34

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 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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
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.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

717 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