Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default after clearcontents() new data is positioned below the cleared ran

Hey eb
I am clearing the contents of one sheet using clearcontents().

Then transferring new data to that sheet using dts (data transformation task).

Unfortunatly that data is positioned in the sheet, below the range i had
cleared befor,instead of replacing the empty rows there.

Any idea why??

TIA
Rea
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default after clearcontents() new data is positioned below the cleared ran

Activesheet.ClearContents
ActiveWorkbook.Save

Excel will hold in memory where the data was before it was cleared so it can
do things like Undo. To prove this, clear a sheet of data and then hit
Ctrl+End. Now hit the Disk icon to save it and do Ctrl+End again.

Mike F
"Rea Peleg" wrote in message
...
Hey eb
I am clearing the contents of one sheet using clearcontents().

Then transferring new data to that sheet using dts (data transformation
task).

Unfortunatly that data is positioned in the sheet, below the range i had
cleared befor,instead of replacing the empty rows there.

Any idea why??

TIA
Rea



  #3   Report Post  
Posted to microsoft.public.excel.programming
Rea Rea is offline
external usenet poster
 
Posts: 6
Default after clearcontents() new data is positioned below the cleared

You are right! but...
I think i am doing the same in my code.
I clear the sheet, save it and quit the excel application all together:
'clear content of dataRange
dataRange.Offset(2, 0).ClearContents
xlWb.Save
xlWb.Close
xlApp.Quit

Only then I continue to the next step in my dts package - where i do the new
data
insertion using data transformation task.
From some reason that sheet behaves as if it was not yet saved after being
cleared before..

Thanks alot
Rea



"Mike Fogleman" wrote:

Activesheet.ClearContents
ActiveWorkbook.Save

Excel will hold in memory where the data was before it was cleared so it can
do things like Undo. To prove this, clear a sheet of data and then hit
Ctrl+End. Now hit the Disk icon to save it and do Ctrl+End again.

Mike F
"Rea Peleg" wrote in message
...
Hey eb
I am clearing the contents of one sheet using clearcontents().

Then transferring new data to that sheet using dts (data transformation
task).

Unfortunatly that data is positioned in the sheet, below the range i had
cleared befor,instead of replacing the empty rows there.

Any idea why??

TIA
Rea




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 233
Default after clearcontents() new data is positioned below the cleared ran

shouldn't

Dim x As Integer
x = Activesheet.UsedRange.Rows.Count instead of ActiveWorkbook.Save

do a reset also?

Dm Unseen

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 233
Default after clearcontents() new data is positioned below the cleared ran

Since you need to write excel code anyway, why do you push the data to
excel with DTS instead of pulling the data with
Queries/QueryTable/PivotTable/ADO ?



  #6   Report Post  
Posted to microsoft.public.excel.programming
Rea Rea is offline
external usenet poster
 
Posts: 6
Default after clearcontents() new data is positioned below the cleared

Because it's easier..
Any way did it now with ado and vbscript
and it works fine.

"DM Unseen" wrote:

Since you need to write excel code anyway, why do you push the data to
excel with DTS instead of pulling the data with
Queries/QueryTable/PivotTable/ADO ?


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Match Multiple Criteria and Return values positioned above the zero Sam via OfficeKB.com Excel Worksheet Functions 6 November 26th 09 06:52 PM
Password cleared in clean up Fiona[_2_] Excel Discussion (Misc queries) 0 January 12th 09 05:10 AM
How do I clear the Field pulldowns after the data is cleared? Fred Excel Discussion (Misc queries) 1 June 6th 06 05:06 PM
why the value in the column X is cleared sal21 Excel Programming 0 September 16th 04 03:31 PM
why the value in the column X is cleared sal21[_32_] Excel Programming 0 September 16th 04 03:12 PM


All times are GMT +1. The time now is 12:01 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"