Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On 5 Set, 00:11, Santhosh Pasupuleti
wrote: I really appreciate you guys spending time on this. I will make it simple.. I tried as suggested by you and Dave. I dont have any formulas in the sheet but this data is referenced from different sheet using formulas. Please find the code below: As stated in MSDN, the only difference between this property and the Value property is that the Value2 property doesn’t use the Currency and Date data types. Since the object doesnt show Value property, I decided to use Value2. * * * * * * ws = (Excel._Worksheet)wb.ActiveSheet; * * * * * * Excel.Range rj; * * * * * * rj = ws.Rows.get_Range("A1", "Z100"); * * * * * * rj.Select(); * * * * * * rj.Value2 = ""; * * * * * * wb.Save(); Still it doesnt work. Thanks and Regards, Santhosh Kumar.P ---------------------------------------------------------------------------*-------------------------- "JLGWhiz" wrote: If you have no formulas in the range you are attempting to clear, then ClearContents should work. *If you do have formulas in the range, the ClearContents will also clear the formulas and you indicated that you only wanted to clear the data. *To just clear the data, you would have to make the Value of the cells in the range equal a null string value. *Like Dave stated. I am not really sure about the code you are using. *It appears that you are trying to Set amd object variable but with the Set keyword. *The way it is written, if it did anything it would create a variable for a massive array, I think. *If you are trying to create rj as a range then you would have to use the Set statement. *Then the range would have a value property and you could use the null string to clear the data in the range. "Santhosh Pasupuleti" wrote in ... Thanks for the quick reply. There is no property called Value for range and there is "range2". Were you referring to this? And why isnt the clear contents method working? any Idea? "JLGWhiz" wrote: Try: rj.Value = "" "Santhosh Pasupuleti" <Santhosh wrote in ... Hi, I am trying to clear the row data keeping formatting in tact and unfortunately the code below doesnt work. I tried using Clear contents menthod as well as clear notes and it is of no use. Can anyone please tell me how to delete the data keeping row formatting in tact? ws.Rows.get_Range("A1", "Z" + (dss.Tables[0].Rows.Count).ToString()).ClearContents(); or Excel.Range rj; * * * * * *rj = ws.Rows.get_Range("A1", "Z" + (dss.Tables[0].Rows.Count).ToString()); * * * * * *rj.ClearContents(); Thanks and Regards, Santhosh Kumar.P- Nascondi testo citato - Mostra testo citato - Hi Santosh. It seems you dont know that excel has his own language (Vba); for beginning to learn the excel Vba you can use the help on line, and probably this might be an easy matter for people like you. Regards Eliano |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Clearing contents from a range | Excel Programming | |||
Clearing the Contents of a range of cells | Excel Programming | |||
Clearing Values in a Range under certain conditions | Excel Programming | |||
need some help clearing a range | Excel Programming | |||
Clearing a Range | Excel Programming |