Thread: Macro Problem
View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
Daren Daren is offline
external usenet poster
 
Posts: 162
Default Macro Problem

I created it in Personal Workbook. I executed it using personal workbook
into a different file and that didn't work. Am I missing something here in
trying to put it in a template somewhere and then running it?

"Don Guillett" wrote:

If you have the desired file and sheet active and fire the macro from the
original macro module by selecting and touching f5 it will execute in the
desired sheet. Or, from the menu
tools macromacrosall open workbooksselect itrun

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Daren" wrote in message
...
The macro only executed in the file where I created it. It didn't execute
in
the others. Where can I make a template sheet? Would I be able to copy
from
the template sheet into the editor of another file?

"Don Guillett" wrote:

Other than cleaning up the code what do you want? It seems that making a
template sheet might be better??

Sub ddd()
Columns("J:P").NumberFormat = "m/d/yyyy"
Columns("B").Insert
Range("B1") = "NSC# Check"
Range("B2").FormulaR1C1 = "=LEN(TRIM(RC[-1]))"
With Range("B2")
.FormatConditions.Delete
.FormatConditions.Add Type:=xlCellValue, Operator:=xlGreater, _
Formula1:="10"
.FormatConditions(1).Interior.ColorIndex = 3
.Copy Range("B3:B15000")
End With

Range("B2").Copy Range("B3:B15000")
Columns("D").Insert Shift:=xlToRight
Range("D1") = "EIN# Check"
Range("D2").FormulaR1C1 = "=LEN(TRIM(RC[-1]))"

With Range("D2")
.FormatConditions.Delete
.FormatConditions.Add Type:=xlCellValue, Operator:=xlGreater, _
Formula1:="9"
.FormatConditions(1).Interior.ColorIndex = 3
.Copy Range("D3:D15000")
End With
'etc

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Daren" wrote in message
...
Sorry, here is the actual code:

Columns("J:P").Select
Selection.NumberFormat = "m/d/yyyy"
Cells.Select
Cells.EntireColumn.AutoFit
Columns("B:B").Select
Selection.Insert Shift:=xlToRight
Range("B1").Select
ActiveCell.FormulaR1C1 = "NSC# Check"
Range("B2").Select
ActiveCell.FormulaR1C1 = "=LEN(TRIM(RC[-1]))"
Range("B2").Select
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlCellValue,
Operator:=xlGreater,
_
Formula1:="10"
Selection.FormatConditions(1).Interior.ColorIndex = 3
Selection.Copy
Range("B3:B15000").Select
Application.CutCopyMode = False
Selection.Copy
ActiveSheet.Paste
Range("B2").Select
Application.CutCopyMode = False
Selection.Copy
Range("B3:B15000").Select
ActiveSheet.Paste
Columns("D:D").Select
Application.CutCopyMode = False
Selection.Insert Shift:=xlToRight
Range("D1").Select
ActiveCell.FormulaR1C1 = "EIN# Check"
Range("D2").Select
ActiveCell.FormulaR1C1 = "=LEN(TRIM(RC[-1]))"
Range("D2").Select
Selection.Copy
Range("D2").Select
Application.CutCopyMode = False
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlCellValue,
Operator:=xlGreater,
_
Formula1:="9"
Selection.FormatConditions(1).Interior.ColorIndex = 3
Selection.Copy
Range("D3:D15000").Select
ActiveSheet.Paste
Columns("F:F").Select
Application.CutCopyMode = False
Selection.Insert Shift:=xlToRight
Range("F1").Select
ActiveCell.FormulaR1C1 = "NPI# Check"
Range("F2").Select
ActiveCell.FormulaR1C1 = "=LEN(TRIM(RC[-1]))"
Range("F2").Select
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlCellValue,
Operator:=xlGreater,
_
Formula1:="10"
Selection.FormatConditions(1).Interior.ColorIndex = 3
Selection.Copy
Range("F3:F15000").Select
ActiveSheet.Paste
ActiveWindow.SmallScroll ToRight:=5
Columns("H:H").Select
Application.CutCopyMode = False
Selection.Insert Shift:=xlToRight
Range("H1").Select
ActiveCell.FormulaR1C1 = "Check Legal Business Name for Blanks"
Range("H2").Select
Columns("H:H").ColumnWidth = 49.43
ActiveWindow.ScrollColumn = 7
ActiveWindow.ScrollColumn = 6
ActiveCell.FormulaR1C1 = "=RC[-1]="""""
Range("H2").Select
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression,
Formula1:="=G2="""""
Selection.FormatConditions(1).Interior.ColorIndex = 3
Selection.Copy
Range("H3:H15000").Select
ActiveSheet.Paste
ActiveWindow.SmallScroll ToRight:=1
Columns("J:J").Select
Application.CutCopyMode = False
Selection.Insert Shift:=xlToRight
Range("J1").Select
ActiveCell.FormulaR1C1 = "Check Site Name for Blanks"
Range("J2").Select
ActiveCell.FormulaR1C1 = "=RC[-1]="""""
Range("J2").Select
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression,
Formula1:="=I2="""""
Selection.FormatConditions(1).Interior.ColorIndex = 3
Selection.Copy
Range("J3:J15000").Select
ActiveSheet.Paste
ActiveWindow.SmallScroll ToRight:=2
Columns("L:L").Select
Application.CutCopyMode = False
Selection.Insert Shift:=xlToRight
Range("L1").Select
ActiveCell.FormulaR1C1 = "Check Physical Address for Blanks"
Range("L2").Select
ActiveCell.FormulaR1C1 = "=RC[-1]="""""
Range("L2").Select
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression,
Formula1:="=K2="""""
Selection.FormatConditions(1).Interior.ColorIndex = 3
Selection.Copy
Range("L3:L15000").Select
ActiveSheet.Paste
Columns("N:N").Select
Application.CutCopyMode = False
Selection.Insert Shift:=xlToRight
Range("N1").Select
ActiveCell.FormulaR1C1 = "Check if City Has Blanks"
Range("N2").Select
ActiveCell.FormulaR1C1 = "=RC[-1]="""""
Range("N2").Select
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression,
Formula1:="=M2="""""
Selection.FormatConditions(1).Interior.ColorIndex = 3
ActiveWindow.SmallScroll ToRight:=1
Selection.Copy
Range("N3:N15000").Select
ActiveSheet.Paste
Columns("P:P").Select
Application.CutCopyMode = False
Selection.Insert Shift:=xlToRight
Range("P1").Select
ActiveCell.FormulaR1C1 = "Check if State is Blank"
Range("P2").Select
Columns("P:P").EntireColumn.AutoFit
ActiveCell.FormulaR1C1 = "=RC[-1]="""""
Range("P2").Select
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression,
Formula1:="=O2="""""
Selection.FormatConditions(1).Interior.ColorIndex = 3
Selection.Copy
Range("P3:P15000").Select
ActiveSheet.Paste
Columns("R:R").Select
Application.CutCopyMode = False
Selection.Insert Shift:=xlToRight
Range("R1").Select
ActiveCell.FormulaR1C1 = "Check if Zip Greater than 5 Characters"
Range("R2").Select
Columns("R:R").EntireColumn.AutoFit
ActiveCell.FormulaR1C1 = "=LEN(RC[-1])"
Range("R2").Select
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlCellValue,
Operator:=xlGreater,
_
Formula1:="5"
Selection.FormatConditions(1).Interior.ColorIndex = 3
Selection.Copy
Range("R3:R15000").Select
ActiveSheet.Paste
ActiveWindow.SmallScroll ToRight:=5
Columns("W:W").Select
Application.CutCopyMode = False
Selection.Insert Shift:=xlToRight
Range("W1").Select
ActiveCell.FormulaR1C1 = "Check Date Progression"
Range("W2").Select
ActiveCell.FormulaR1C1 =
"=AND(RC[-1]RC[-2],RC[-2]RC[-3],RC[-3]RC[-4])"
Range("W2").Select
Selection.NumberFormat = "General"
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual,
_
Formula1:="FALSE"
Selection.FormatConditions(1).Interior.ColorIndex = 3
Selection.Copy
Range("W3:W15000").Select
ActiveSheet.Paste
Range("W2").Select
End Sub

Thanks!


"Mike H" wrote:

That depends on what the macro does, post the code

"Daren" wrote:

Hello,

I recorded a macro and noticed while recording that Excel was
autosaving.
When I ran the macro in another file, all it did was put in the
formulas and
formats where they were supposed to be. What might be the issue?

Thanks.