Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Clearing Non-numerical CellCvalues

Hello, I have a range (D9:DP496) that contains numerical values and
text. I want to clear all the cells that do not have numerical values.
I attempted it below but failed miserably. As you can see I am a new
learner to VBA. Can you help?

If Workbooks("Regional Banks.xls").Worksheets("Regional
Banks").Range("D9:DP496") < Format ("#") Then Cells.Value = ""
End If

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default Clearing Non-numerical CellCvalues

try this and see if it works for you


Sub test()
Dim cell As Range
For Each cell In Range("D9:DP496")
If IsNumeric(cell.Value) Then
cell.Value = cell.Value
Else
cell.Value = ""
End If
Next
End Sub

--


Gary


"alistre" wrote in message
oups.com...
Hello, I have a range (D9:DP496) that contains numerical values and
text. I want to clear all the cells that do not have numerical values.
I attempted it below but failed miserably. As you can see I am a new
learner to VBA. Can you help?

If Workbooks("Regional Banks.xls").Worksheets("Regional
Banks").Range("D9:DP496") < Format ("#") Then Cells.Value = ""
End If


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 923
Default Clearing Non-numerical CellCvalues

This should work.......

Sub ClearArea()
Dim Cell As Range
Application.ScreenUpdating = False

With Sheets("Sheet1")
For Each Cell In .Range("D9:DP496")
If Not IsNumeric(Cell.Value) Then Cell.Value = ""
Next
End With

Application.ScreenUpdating = True
End Sub


--
Cheers
Nigel



"alistre" wrote in message
oups.com...
Hello, I have a range (D9:DP496) that contains numerical values and
text. I want to clear all the cells that do not have numerical values.
I attempted it below but failed miserably. As you can see I am a new
learner to VBA. Can you help?

If Workbooks("Regional Banks.xls").Worksheets("Regional
Banks").Range("D9:DP496") < Format ("#") Then Cells.Value = ""
End If



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 923
Default Clearing Non-numerical CellCvalues

Forgot to mention - change the Sheet1 reference as required, in your case
this would be.....

With Sheets("Regional Banks") not With Sheets("Sheet1")

--
Cheers
Nigel



"Nigel" wrote in message
...
This should work.......

Sub ClearArea()
Dim Cell As Range
Application.ScreenUpdating = False

With Sheets("Sheet1")
For Each Cell In .Range("D9:DP496")
If Not IsNumeric(Cell.Value) Then Cell.Value = ""
Next
End With

Application.ScreenUpdating = True
End Sub


--
Cheers
Nigel



"alistre" wrote in message
oups.com...
Hello, I have a range (D9:DP496) that contains numerical values and
text. I want to clear all the cells that do not have numerical values.
I attempted it below but failed miserably. As you can see I am a new
learner to VBA. Can you help?

If Workbooks("Regional Banks.xls").Worksheets("Regional
Banks").Range("D9:DP496") < Format ("#") Then Cells.Value = ""
End If





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Clearing Non-numerical CellCvalues

Worked like a charm. You're a genious.

Nigel wrote
This should work.......

Sub ClearArea()
Dim Cell As Range
Application.ScreenUpdating = False

With Sheets("Sheet1")
For Each Cell In .Range("D9:DP496")
If Not IsNumeric(Cell.Value) Then Cell.Value = ""
Next
End With

Application.ScreenUpdating = True
End Sub


--
Cheers
Nigel



"alistre" wrote in message
oups.com...
Hello, I have a range (D9:DP496) that contains numerical values and
text. I want to clear all the cells that do not have numerical values.
I attempted it below but failed miserably. As you can see I am a new
learner to VBA. Can you help?

If Workbooks("Regional Banks.xls").Worksheets("Regional
Banks").Range("D9:DP496") < Format ("#") Then Cells.Value = ""
End If




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
How do I resort numerical info into numerical order Liz M Excel Worksheet Functions 1 May 19th 10 12:09 PM
Clearing cells without clearing formulas marsjune68 Excel Discussion (Misc queries) 2 April 10th 09 07:39 PM
Clearing A Row alex1982[_7_] Excel Programming 2 August 18th 06 04:39 PM
Clearing #N/A's in one go? Lee Harris Excel Worksheet Functions 5 November 22nd 05 06:52 PM
Clearing #VALUE skateblade Excel Worksheet Functions 3 October 15th 05 10:34 PM


All times are GMT +1. The time now is 05:55 PM.

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"