importing text data into Excel sheet

abeed

Board Regular
Joined
Nov 19, 2005
Messages
79
Hi there: I have a workbook with 3 worksheets. I am impoting data into sheet1 and creating a report in sheet2.
Next I want to import data again in sheet1 and create another report in sheet3. But in the 2nd import, I still have the data that I imported 1st time for sheet2. How can I clean all data that I imported for sheet2? So that when I import data for sheet3, I will have fresh data in sheet1.

or do you have any better idea?
Thanks in advance
 
Hi tony:

Thanks a lot. I would request you for this new question.

How can I declare the same number as the columnwidth for several columns. Say I have an Excel sheet that has 13 column with data after importing data into it. How can I set all these columnwidth to 11 and datatype to text format for all 13 columns while importing data.
I was doing this way:

with ActiveSheet
.xlcelcolumnwidth = array(11,11,11...)--I dont want to repeat 13 times.
.xltypeformat = array(xltextformat)---Am I right??
 
Upvote 0

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Hi

1) column width
columns("A:M").columnwidth = 11

2) text format
columns("A:M").numberformat = "@"

Tony
 
Upvote 0
Hi Tony:

As this will happen in my VB code after importing data into the sheet, I really dont know the last column(data will vary in columns). How can I set all columnwidth in the active sheet as 11.

Thanks again
 
Upvote 0
Hi

If you know a row which will always have data in the rightmost column then you could do something like

Range("a1", Cells(1, Columns.Count).End(xlToLeft).Address).EntireColumn.columnwidth = 11

In this case, I've assumed that there will be data in row 1.


Tony
 
Upvote 0

Forum statistics

Threads
1,214,651
Messages
6,120,744
Members
448,989
Latest member
mariah3

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