A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

#REF! help



 
 
Thread Tools Display Modes
  #1  
Old August 21st, 2005, 06:36 AM
bill gras
external usenet poster
 
Posts: n/a
Default #REF! help

I copy and paste a web page into excel in sheet1
The page I import changes every day and is different
in size , I delete all data in sheet 1 and copy and paste
the new web page in sheet 1.
I cannot use "clear contents " as the new web page size is
different to the last web page.
I have all my work sheet function formulas to extract data
from sheet 1 in sheet 2.When I delete sheet 1, I get #REF!
errors in all my formulas in sheet 2.
Is ther a way to over come this?
I would like a work sheet function if there is one

Thanks for all reply's

regards Bill
--
bill gras
  #2  
Old August 21st, 2005, 06:54 AM
R.VENKATARAMAN
external usenet poster
 
Posts: n/a
Default

why not try
sheet1.usedrange.clearcontents



bill gras wrote in message
...
I copy and paste a web page into excel in sheet1
The page I import changes every day and is different
in size , I delete all data in sheet 1 and copy and paste
the new web page in sheet 1.
I cannot use "clear contents " as the new web page size is
different to the last web page.
I have all my work sheet function formulas to extract data
from sheet 1 in sheet 2.When I delete sheet 1, I get #REF!
errors in all my formulas in sheet 2.
Is ther a way to over come this?
I would like a work sheet function if there is one

Thanks for all reply's

regards Bill
--
bill gras



  #3  
Old August 21st, 2005, 07:03 AM
bill gras
external usenet poster
 
Posts: n/a
Default

Thanks for your reply
Can you tell me how and where to apply your formula
Thanks
--
bill gras


"R.VENKATARAMAN" wrote:

why not try
sheet1.usedrange.clearcontents



bill gras wrote in message
...
I copy and paste a web page into excel in sheet1
The page I import changes every day and is different
in size , I delete all data in sheet 1 and copy and paste
the new web page in sheet 1.
I cannot use "clear contents " as the new web page size is
different to the last web page.
I have all my work sheet function formulas to extract data
from sheet 1 in sheet 2.When I delete sheet 1, I get #REF!
errors in all my formulas in sheet 2.
Is ther a way to over come this?
I would like a work sheet function if there is one

Thanks for all reply's

regards Bill
--
bill gras




  #4  
Old August 21st, 2005, 01:04 PM
David McRitchie
external usenet poster
 
Posts: n/a
Default

Hi Bill,

I think it was unclear why you could not use Clear Contents,
One reason you can't use clear contents is because it does not touch formats (, or comments, or shapes)
Clear contents is the same as using the Del key

Instead you would want to use Edit, Clear, Clear All, though it will not clear shapes
that you might have also acquired from copying and pasting from a web page.
http://www.mvps.org/dmcritchie/excel/shapes.htm

Don't know what you are doing with preparations after bringing in Internet data, but
if you delete rows, I think you would still end up with #REF errors in your other worksheet(s).


The simplest would be to use the menus
Ctrl+A to select all cells
Edit, Clear, Clear Contents Del

Of course if you are using Excel 2003 you should "know" to
use Ctrl+Shift+SpaceBar instead of Ctrl+A
http://www.mvps.org/dmcritchie/excel...x2k.htm#foobar

The code that R.Venkataraman supplied is a single line of code to be included in a wrapper as a macro.
If you are not familiar with installing and using a macro see
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Examples to clear a specific sheet: sheet1 or 'sheet one'

Sub clearsheet1()
sheet1.cells.clear 'changed to cells instead of usedrange
end sub

Sub clearsheetone()
Sheets("sheet one").cells.Clear
end sub

Since it is for a specific sheet, you could use an Event macro instead
http://www.mvps.org/dmcritchie/excel/event.htm
which would only apply to the sheet that it is in. It could have just the
one line, or you could make it a bit more accident proof.

Event macros are installed differently -- Install this Event macro as follows:
- right click on sheet tab
- view code
- place code after the line "option explicit"

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim ans As String
If Target.Address(0, 0) "A1" Then
MsgBox "Double click must be from A1 to clear this sheet", _
vbOK, "Must Double click from A1 to Clear This Sheet"
Exit Sub
End If
ans = MsgBox("Press 'OK' to Clear this worksheet", _
vbOKCancel, "Verify Clear Contents, Comments, Formats")
If ans = vbCancel Then Exit Sub
ActiveSheet.Cells.Clear
ActiveSheet.Shapes.SelectAll '*** warning DELETE all Shapes
Selection.Delete '*** delete selected shapes OR cell seleection
End Sub

---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"bill gras" wrote in message ...
Thanks for your reply
Can you tell me how and where to apply your formula
Thanks
--
bill gras


"R.VENKATARAMAN" wrote:

why not try
sheet1.usedrange.clearcontents



bill gras wrote in message
...
I copy and paste a web page into excel in sheet1
The page I import changes every day and is different
in size , I delete all data in sheet 1 and copy and paste
the new web page in sheet 1.
I cannot use "clear contents " as the new web page size is
different to the last web page.
I have all my work sheet function formulas to extract data
from sheet 1 in sheet 2.When I delete sheet 1, I get #REF!
errors in all my formulas in sheet 2.
Is ther a way to over come this?
I would like a work sheet function if there is one

Thanks for all reply's

regards Bill
--
bill gras






  #5  
Old August 21st, 2005, 01:20 PM
David McRitchie
external usenet poster
 
Posts: n/a
Default

actually should have just deleted this paragraph
since it should have just been "ALL" instead of "contents"
and had inserted similar information earlier.

The simplest would be to use the menus (corrected as follows)
Ctrl+A to select all cells (in Excel 2003 use instead Ctrl+Shift+Spacebar)
Edit, Clear, All


  #6  
Old August 22nd, 2005, 11:13 AM
bill gras
external usenet poster
 
Posts: n/a
Default

Thanks for your help , R.Venkataraman and David Mc Ritchie
very much appreciated
--
bill gras


"bill gras" wrote:

I copy and paste a web page into excel in sheet1
The page I import changes every day and is different
in size , I delete all data in sheet 1 and copy and paste
the new web page in sheet 1.
I cannot use "clear contents " as the new web page size is
different to the last web page.
I have all my work sheet function formulas to extract data
from sheet 1 in sheet 2.When I delete sheet 1, I get #REF!
errors in all my formulas in sheet 2.
Is ther a way to over come this?
I would like a work sheet function if there is one

Thanks for all reply's

regards Bill
--
bill gras

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:30 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.