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
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
HI

Assuming that you know the range the data will be imported into then something like

range("a1:f50").clearcontents
or
columns("A:C").clearcontents

Tony
 
Upvote 0
To add to Tony's post, to clear an entire sheet I have also used;

Sheets("Sheet1").UsedRange.ClearContents
 
Upvote 0
Hi: Thanks a lot both of you. This been a great help.
I would be asking you again next few days. I am preparing a report.
Thanks again.
 
Upvote 0
Last used row in a column

Hi: how can I find out the last row in a certain column. Say I have a very long column with data and in my VB code I need to know what is the last row with data under this column. Assume all intermediate cells have data.(say Range(A1,Alastused etc).
I want to put the total of this colum at the cell which will be the next of the last used cell under that column.

Thanks in advance
 
Upvote 0
I do the same thing in one of my reports. I always have it in the total at the top. Whoever opens the report sees the info right away.

However, If you want it at the end I know someone will show you how to write code to get the desired last cell.

Michael :oops:
 
Upvote 0
Hi Michael:
Thanks. Even if you put the total at the top, how do you know the total number of rows to add up. Assuming you dont want to see the last cell or say this is happening while writing the VB code.

Abeed
 
Upvote 0
Hi

To get the lastrow in a column then something like

lastrow = cells(rows.count,"A").end(xlup).row

This will get the last row in column A and put the number into the variable lastrow.


Tony
 
Upvote 0
Hi tony:
lastrow = cells(rows.count,"A").end(xlup).row
Will this give me last row with data or last possible row in a sheet under certain column. I need last row with data in a column.

Thanks
 
Upvote 0
Hi

Last row with data in a particular column (in this example, column A) on the currently active sheet.

Note that if you are trying to get this information on the non active sheet, then you will have to use the sheet name
lastrow = sheets("yourname").cells(rows.count,"A").end(xlup).row


Tony
 
Upvote 0

Forum statistics

Threads
1,214,376
Messages
6,119,180
Members
448,871
Latest member
hengshankouniuniu

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