On Tue, 22 Jul 2008 11:49:30 -0700 (PDT), Spiky <(E-Mail Removed)>
wrote:
Well, it's not the most efficient code, but it's not causing those problems.
>
>Here are the problems I have after running this macro:
>
>1) Redo/Repeat stops working. It says "Repeat Macros" in the Edit
>menu, but doesn't actually DO anything when selected. It never changes
>from "Repeat Macros", so the Repeat command is lost til I restart
>Excel. Menu selection, F4, CTRL-Y, nothing works.
Running *any* macro kills the undo stack so you can't undo/repeat. Once
it's done, however, it should be back working, just without any entries from
before the macro was run.
>2) It affects the size of the file. I always delete the entire columns
>where the download was pasted, yet the workbook keeps growing as if I
>leave the full raw data in there every single time I do this. After a
>few months, the file has quadrupled in size.
Maybe doing the Unmerge and Wrap on every cell is causing it. I'm not sure
on that, but see the macro below.
>3) It 'sticks' to the file somehow. When I send files to certain
>companies, their over-zealous security deletes any emails with
>attachments containing macros. These files do not contain this (or
>any) macro, it is stored in Personal. Yet the firewalls claim there is
>a macro after I run it on these files, and block my emails.
You probably have an empty module in the workbook. Open the VBE (Alt+F11)
and the Project Explorer (Ctl+R). Make sure there are no modules,
userforms, or class modules in the project. Also, open the Microsoft Excel
Objects (like Sheet1) and make sure there's no code in any of those.
>
>
>Code:
>
>Sub Clean()
>'
>' Clean Macro
>' Macro recorded 1/25/2007
>'
>
>'
> Cells.Replace What:=" ", Replacement:="", LookAt:=xlPart,
>SearchOrder _
> :=xlByRows, MatchCase:=False, SearchFormat:=False,
>ReplaceFormat:=False
> ActiveSheet.DrawingObjects.Delete
> Cells.Select
> Selection.UnMerge
> Selection.WrapText = False
> Range("B:IV").Select
> Selection.Style = "Comma"
> Range("A1").Select
>
>End Sub
With ActiveSheet.UsedRange
.Replace What:=" ", Replacement:="", LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False, SearchFormat:=False,
ReplaceFormat:=False
.UnMerge
.WrapText = False
End With
ActiveSheet.DrawingObjects.Delete
Intersect(ActiveSheet.Range("B:IV"), ActiveSheet.UsedRange).Style = "Comma"
--
Dick
|