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

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

Forum statistics

Threads
1,223,903
Messages
6,175,279
Members
452,630
Latest member
OdubiYouth

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