Thread: Macro
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
David McRitchie David McRitchie is offline
external usenet poster
 
Posts: 903
Default Macro

Hi "sa02000",
There is no boldface in a text newsgroup perhaps your ExcelForum
changes them when sending. Here is the thread in Google Groups.
http://groups.google.com/groups?thre...GP15.phx .gbl

There is no loop in the two macros within the previously referenced
topic on my webpage. If I understand the second part I think that can
be done without a loop as well.

Select cell at top of data in column to be worked
Ctrl+Shift+ArrowDown
will select cells down to a blank cell and will include error cells
Ctrl+G (edit, goto), constants and [x] errors
-- will have to add error statment
Del key to clear errors
type in 33 into the first occurrence of error
Ctrl+D to fill down

created data in f3:f20
cleared F18
#n/a into cell in F5 and F7
=#n/a into cell F11 and F15
select cell f3 and run macro

Sub Macro12()
Range(Selection, Selection.End(xlDown)).Select
Selection.SpecialCells(xlCellTypeConstants, 16).Select
msgbox err.code
exit sub
Selection.ClearContents
ActiveCell.FormulaR1C1 = "33"
Selection.FillDown
End Sub

Sub Macro12()
Dim rng As Range '-- added
Set rng = Selection '-- added
Range(Selection, Selection.End(xlDown)).Select
On Error Resume Next '-- added
Selection.SpecialCells(xlCellTypeConstants, 16).Select
If Err.Number = 0 Then '-- added it is not 1004
Selection.ClearContents
ActiveCell.FormulaR1C1 = "33"
Selection.FillDown
End If
rng.Select '-- added
Range(Selection, Selection.End(xlDown)).Select
On Error Resume Next '-- added
Selection.SpecialCells(xlCellTypeFormulas, 16).Select
If Err.Number = 0 Then '-- added it is not 1004
Selection.ClearContents
ActiveCell.FormulaR1C1 = "33"
Selection.FillDown
End If '-- added
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

"sa02000" wrote in message
...

Dave, it works great. Thank you very much.

I apologize for caps in my original post. But I am not sure how you had
capital letters in your post where as my post did not show capital
letters. I had no intention of being rude or shouting at anyone at
all.
I did try to make the part of my request bold so that it stands out and
makes it little easier to read.

Also, you got a macro for second request that I had in my original
post. Here is the request again.

Parse through all the cells in column, lets say, “I” and if a cell has
“#N/A” value then fill cell with some value or if a cell has something
else then do nothing and go to next cell or if cell is empty then stop.