Excel - Exporting data to another spreadsheet

June 2017

Exporting data from one Excel spreadsheet to another spreadsheet is always a problem if you want to have the same flavor in the second too. Quite often, whenever a file from the Internet is being exported, it is being saved in a new file, not in the existing one. It takes so much time to reconfigure it. To solve this problem, one has to use data - import external data option under Excel with a new web query where the address of the web page has to be pasted. Then, using the import option, the proper destination can be sorted out.

Issue

  • I have a query. Whenever I export a file from the internet the data gets saved into a new Excel file instead of the Excel sheet I am working in. As a result I have to copy the data from that file to the Excel file I am working in. This is very time consuming. Is there a shorter method to directly export the data into the working Excel file?
  • I have another separate problem. I have recorded a macro for a particular worksheet. That macro does two things. 1. There are two cols. Column A and Column B. In col C it subtracts Col A from B. 2. It finds the weighted average between col A and C.

Now I want to run this macro in all worksheets except the first worksheet. What is the code to do that? </ital>

Solution


To solve this problem:
  • Copy the webpage address in Excel clipboard.
  • Go to your sheet.
  • Select any cell from where you want the file to be copied. e.g. A1.
  • Click data-import external data (or something like this depending upon the version) - new web query.
  • In the new web query window paste the address of the webpage at the top against "address".
  • Click on Go
  • You will get the whole webpage. Whatever table you want, click the tick mark and the whole table will be marked
  • Click "import" at the bottom right
  • It will ask where you want to park it. If it is already A1 click ok


To solve the second issue:
Sub test1()     
Dim j As Integer, k As Integer     
j = Worksheets.Count     
'MsgBox j     
For k = 1 To j     
'MsgBox Sheets(k).Name     
If Sheets(k).Name = "Sheet1" Then GoTo nnext     
Sheets(k).Activate     
NAME OF THE MACRO     
nnext:     
Next k     
End Sub

Note that


Thanks to venkat1926 for this tip on the forum.

Related


Published by aakai1056. Latest update on November 6, 2012 at 08:29 AM by Jeff.
This document, titled "Excel - Exporting data to another spreadsheet," is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (ccm.net).