Forum Discussion
Greg Bonaparte
Aug 20, 2020Iron Contributor
Trouble using Dim in macro
The following macro worked fine. Some how I messed it up and working weeks to figure it out. Look for BF87. I am forced to manually put in a different value everytime I run the macro because the "paste formula" wont land on the "lr" line. Hope someone can help. Note that Dim is not in code because I could never get it to work right.
Sub GreaterThan17k()
Range("S2").Value = Range("R2").Value
Application.EnableEvents = False
Range("R2,T2:T27,U2:U11,V2:V5,U41:U3880").ClearContents
With Application
.Calculation = xlCalculationAutomatic
.ScreenUpdating = True
.DisplayStatusBar = True
.EnableEvents = False
End With
Range("B41:BF81").Select
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Add2 _
Key:=Range("R41:R87"), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Sheet1").Sort
.SetRange Range("B41:BF87")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("R2").Value = Range("S2").Value
Range("T2").Value = Range("R2").Value
Range("T3").Value = Range("R10").Value
Range("AU41:AU64").Copy
Range("T4").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Range("U2").Value = Range("R19").Value
Range("U3").Value = Range("Q10").Value
Range("R2").Value = Range("U2").Value
Range("AT41:AT48").Copy
Range("U4").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Range("V2").Value = Range("Q19").Value
Range("V3").Value = Range("P10").Value
Range("R2").Value = Range("U2").Value
Range("AS41:AS42").Copy
Range("V4").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Range("R2").Select
With Application
.ScreenUpdating = True
.DisplayStatusBar = True
.EnableEvents = True
End With
Range("BH13").Select
Selection.Copy
Range("BI12").Select
ActiveSheet.Paste
a = MsgBox("APPROVED TRADING INSTRUMENTS MUST DEMONSTRATE" & _
vbCrLf + "LOGARITHMIC PEACHFUZZ VALUE IN COLUMN 'BD'." & _
vbCrLf + "" & _
vbCrLf + "2min chart MFI17, RSI17, OBV, RAINBOW LEAPS STOP HUNT" & _
vbCrLf + "& 4min RAINBOW PARALLELS EMA1 MVWAP1 CROSSING." & _
vbCrLf + "" & _
vbCrLf + "DO YOU WANT TO EDIT HonorSystem24 RESULTS, TO CONFIRM" & _
vbCrLf + "PEACHFUZZ VALUES AND FREESTOCKCHARTS.COM STATUS?", vbQuestion + vbYesNo, "HonorSystem24")
If a = vbYes Then
Call BFClear
ElseIf a = vbNo Then
MsgBox "YOU MIGHT HAVE UNALLOCATED FUNDS REMAINING. SEE 'SUGGESTED' TO ADD ADDITIONAL SHARES"
End If
Application.Calculation = xlManual
Range("V29:X29").Select
Selection.Copy
Range("V30:X30").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("AA29:AC29").Select
Application.CutCopyMode = False
Selection.Copy
Range("AA30:AC30").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("AG29:AJ29").Select
Application.CutCopyMode = False
Selection.Copy
Range("AG30:AJ30").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("AN29:AQ29").Select
Application.CutCopyMode = False
Selection.Copy
Range("AN30:AQ30").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("AT29:AV29").Select
Application.CutCopyMode = False
Selection.Copy
Range("AT30:AV30").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("AY29:BA29").Select
Application.CutCopyMode = False
Selection.Copy
Range("AY30:BA30").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("BD29:BF29").Select
Application.CutCopyMode = False
Selection.Copy
Range("BD30:BF30").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("BI41:BI79").Select
Selection.Copy
Range("BK2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.SmallScroll Down:=1
Range("BI80:BI118").Select
Application.CutCopyMode = False
Selection.Copy
Range("BL2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.ScrollRow = 41
Range("S31:U32").Select
Range("BH13").Select
Selection.Copy
Range("BI4").Select
ActiveSheet.Paste
End Sub,
No RepliesBe the first to reply