Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default Fill #N/A and blank cells with zero

Hi
How can I fill #N/A and Blank cells with Zero in specific area(c10:z200) via
vba.
Grateful for all ideas.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Fill #N/A and blank cells with zero

Try the below macro....You can deal this within your fomulas itself; like
=IF(ISNA(formula),0,formula)


Sub Macro()
For Each cell In Range("C10:z200")
If cell.Text = "" Or cell.Text = "#N/A" Then cell.Value = 0
Next
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"bijan" wrote:

Hi
How can I fill #N/A and Blank cells with Zero in specific area(c10:z200) via
vba.
Grateful for all ideas.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default Fill #N/A and blank cells with zero

Thanks for answer,But may I ask you another question,
after this step I need to save as or copy this sheet just from(c10:z200) in
text format to specific path(E:\TEST\text.txt) any ideas would be appreciated.
Bijan
"Jacob Skaria" wrote:

Try the below macro....You can deal this within your fomulas itself; like
=IF(ISNA(formula),0,formula)


Sub Macro()
For Each cell In Range("C10:z200")
If cell.Text = "" Or cell.Text = "#N/A" Then cell.Value = 0
Next
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"bijan" wrote:

Hi
How can I fill #N/A and Blank cells with Zero in specific area(c10:z200) via
vba.
Grateful for all ideas.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Fill #N/A and blank cells with zero

Try the below

Sub Macro()
Dim wb As Workbook, ws As Worksheet
Dim rngTemp As Range

Set rngTemp = ActiveSheet.Range("C10:Z100")
For Each cell In rngTemp
If cell.Text = "" Or cell.Text = "#N/A" Then cell.Value = 0
Next

Set wb = Workbooks.Add
Set ws = ActiveSheet
rngTemp.Copy ws.Range("A1")
Application.DisplayAlerts = False
wb.SaveAs Filename:="C:\testtxt1.txt", FileFormat:=xlText, _
CreateBackup:=False
wb.Close
Application.DisplayAlerts = True
End Sub


If this post helps click Yes
---------------
Jacob Skaria


"bijan" wrote:

Thanks for answer,But may I ask you another question,
after this step I need to save as or copy this sheet just from(c10:z200) in
text format to specific path(E:\TEST\text.txt) any ideas would be appreciated.
Bijan
"Jacob Skaria" wrote:

Try the below macro....You can deal this within your fomulas itself; like
=IF(ISNA(formula),0,formula)


Sub Macro()
For Each cell In Range("C10:z200")
If cell.Text = "" Or cell.Text = "#N/A" Then cell.Value = 0
Next
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"bijan" wrote:

Hi
How can I fill #N/A and Blank cells with Zero in specific area(c10:z200) via
vba.
Grateful for all ideas.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default Fill #N/A and blank cells with zero

Thank you,For last Question
If my cell range is unknown(C10:Z) and the sheet is non-actived with
name(TEST) then how can I change this code?
Bijan
"Jacob Skaria" wrote:

Try the below

Sub Macro()
Dim wb As Workbook, ws As Worksheet
Dim rngTemp As Range

Set rngTemp = ActiveSheet.Range("C10:Z100")
For Each cell In rngTemp
If cell.Text = "" Or cell.Text = "#N/A" Then cell.Value = 0
Next

Set wb = Workbooks.Add
Set ws = ActiveSheet
rngTemp.Copy ws.Range("A1")
Application.DisplayAlerts = False
wb.SaveAs Filename:="C:\testtxt1.txt", FileFormat:=xlText, _
CreateBackup:=False
wb.Close
Application.DisplayAlerts = True
End Sub


If this post helps click Yes
---------------
Jacob Skaria


"bijan" wrote:

Thanks for answer,But may I ask you another question,
after this step I need to save as or copy this sheet just from(c10:z200) in
text format to specific path(E:\TEST\text.txt) any ideas would be appreciated.
Bijan
"Jacob Skaria" wrote:

Try the below macro....You can deal this within your fomulas itself; like
=IF(ISNA(formula),0,formula)


Sub Macro()
For Each cell In Range("C10:z200")
If cell.Text = "" Or cell.Text = "#N/A" Then cell.Value = 0
Next
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"bijan" wrote:

Hi
How can I fill #N/A and Blank cells with Zero in specific area(c10:z200) via
vba.
Grateful for all ideas.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Fill #N/A and blank cells with zero

Try

Sub Macro()
Dim wb As Workbook, ws As Worksheet
Dim rngTemp As Range

Set rngTemp = Sheets("test").Usedrange
For Each cell In rngTemp
If cell.Text = "" Or cell.Text = "#N/A" Then cell.Value = 0
Next

Set wb = Workbooks.Add
Set ws = ActiveSheet
rngTemp.Copy ws.Range("A1")
Application.DisplayAlerts = False
wb.SaveAs Filename:="C:\testtxt1.txt", FileFormat:=xlText, _
CreateBackup:=False
wb.Close
Application.DisplayAlerts = True
End Sub


If this post helps click Yes
---------------
Jacob Skaria


"bijan" wrote:

Thank you,For last Question
If my cell range is unknown(C10:Z) and the sheet is non-actived with
name(TEST) then how can I change this code?
Bijan
"Jacob Skaria" wrote:

Try the below

Sub Macro()
Dim wb As Workbook, ws As Worksheet
Dim rngTemp As Range

Set rngTemp = ActiveSheet.Range("C10:Z100")
For Each cell In rngTemp
If cell.Text = "" Or cell.Text = "#N/A" Then cell.Value = 0
Next

Set wb = Workbooks.Add
Set ws = ActiveSheet
rngTemp.Copy ws.Range("A1")
Application.DisplayAlerts = False
wb.SaveAs Filename:="C:\testtxt1.txt", FileFormat:=xlText, _
CreateBackup:=False
wb.Close
Application.DisplayAlerts = True
End Sub


If this post helps click Yes
---------------
Jacob Skaria


"bijan" wrote:

Thanks for answer,But may I ask you another question,
after this step I need to save as or copy this sheet just from(c10:z200) in
text format to specific path(E:\TEST\text.txt) any ideas would be appreciated.
Bijan
"Jacob Skaria" wrote:

Try the below macro....You can deal this within your fomulas itself; like
=IF(ISNA(formula),0,formula)


Sub Macro()
For Each cell In Range("C10:z200")
If cell.Text = "" Or cell.Text = "#N/A" Then cell.Value = 0
Next
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"bijan" wrote:

Hi
How can I fill #N/A and Blank cells with Zero in specific area(c10:z200) via
vba.
Grateful for all ideas.

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Fill #N/A and blank cells with zero

Another option is to record a macro when you

select the range
edit|goto|special|Formulas|Uncheck numbers, text, logicals, but leave errors
checked.
click ok
type 0 and hit ctrl enter to fill those cells.

Repeat the process for Constants
and
repeat it once more for blanks



bijan wrote:

Hi
How can I fill #N/A and Blank cells with Zero in specific area(c10:z200) via
vba.
Grateful for all ideas.


--

Dave Peterson
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
Fill/Copy Up to fill blank cells. J.W. Aldridge Excel Programming 3 September 26th 08 05:01 PM
Fill in blank cells Ian Excel Discussion (Misc queries) 3 December 15th 06 08:06 AM
Fill blank cells 3Sixty Excel Programming 1 November 6th 05 10:48 PM
FILL IN BLANK CELLS Charles Excel Discussion (Misc queries) 2 August 8th 05 07:07 PM
Fill blank cells with 0 Cheri[_2_] Excel Programming 5 December 7th 03 08:45 PM


All times are GMT +1. The time now is 01:11 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"