Exporting data to a new xls workbook

Frank10

New Member
Joined
Nov 19, 2018
Messages
7
Hi,

I am trying to export data from an xlsm to a new xls.

But the problem is that it only copies the first row and I need a table to be copied.


My macro is this one:

Sub ExportarTXT()

Worksheets("Import").Activate
If Sheets("Import").Activate Then
Range("A1").Select
If ActiveCell = Empty Then GoTo salte
Open "c:\ZLibra.xls" For Output As 1
regresa:
Codigo = ActiveCell
Print #1 , Codigo
ActiveCell.Offset(1, 0).Select
If ActiveCell = Empty Then GoTo salte
GoTo regresa:

salte:
Close #1
End If
Worksheets("Import").Activate

End Sub


Thanks,
 
Yes I know.

The thing is that the first one leaves the format and I need it. So I stayed with that one.

By refreshing I mean when in a cell you press F2 and then Enter. For instance the date when I export it appears 2/11/2018, When I "refrsh" it it appears 02/11/2018. I need that for all cells.

So first export the data to an XLS then copy and paste values and finally "refreshing" the cells.

Thank you very much for your time and consideration.
 
Upvote 0

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

Forum statistics

Threads
1,215,558
Messages
6,125,511
Members
449,236
Latest member
Afua

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top