Thread: my Franken-code
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
justme justme is offline
external usenet poster
 
Posts: 68
Default my Franken-code

Hi,
I'm brand new to macros and coding in general. I've sifted through this
site for an answer, but there was no one post to cover what I needed, so I
pieced this baby together from different posts.

I will be getting these excel files frequently, and they can contain
thousands of rows. I need a macro that will search all rows and columns in
the active worksheet of any workbook I may choose, regardless of how many
rows it contains.

I need to replace each cell that contains only a single " mark with the
contents of the cell above it (somebody thinks it's a good idea to use ditto
marks in their database). There is legitimate use of quotes elsewhere in the
worksheet


Dim r As Range
Set r = ActiveSheet.UsedRange
r.Replace What:=""", Replacement:=MyCell.Value = ActiveCell.FormulaR1C1 =
"=R[-1]C", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
End Sub


This will not run. But you could probably tell that from reading it, huh?
It says there's a syntax error, but I think it's more than that.

p.s.
I did read a post with a warning that worried me. I can't remember the exact
warning, but it was something about not using a whole worksheet as a range
because the code would remember the amount of rows used each time you ran it
and adjust the code to reflect that. The post said it was better to name a
specific range, but I want to be able to run this code no matter how many
rows.
Is that post true?

PLEASE HELP ME!
Thanx
jen