Excel to SQl 7

  • Thread starter Thread starter Jim
  • Start date Start date
J

Jim

Hello,

I am taking information from an Excel spreadsheet
and importing it into a tab delimited text file and
process the information using a VB 6.0 application that
then spits out several different text files. The issue
that I am having is that when I import from Excel to the
text file it also includes blank cell to the right and
bottom of the information that I need. How do I stop this
from happening? The excel sheet will always vary on its
size.
 
Select entirecolumns to the right of your data and delete them (use the gray
buttons with the column names)

Select entirewors below you data and delete them (use the gray buttons with
the row numbers)

Then save the workbook

This should reset the usedrange

Go to Tools=>Goto => Special and select Last Cell.

It should now go to the bottom right corner of your data.
 
If you have spaces in these extraneous cells, then you will need to remove
them first. If you know the range, then don't use currentregion as below,
specify the range

set rng = Activesheet.Range("A1:Z200")

Dim rng As Range
set rng = Activesheet.Range("A1").CurrentRegion
Workbooks.Add Template:=xlWBATWorksheet
rng.copy Activesheet.Range("A1")
Activeworkbook.SaveAs Filename:="C:\CSVFiles\Myfile.csv", FileFormat:=xlCSV
Activeworkbook.Close Savechanges:=False
 
Back
Top