Thread: Condensing Code
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Steve Steve is offline
external usenet poster
 
Posts: 1,814
Default Condensing Code

I need help passing variables to another sub routine.
Below I have included a piece of code that would need to be repeated 12
times.
Let me know if i have to clarify anything!

The following items would have to be "swapped" out each time:
tbBlackASection1Weight
tbBlackASection1Description
BlackAContractPricePerPound
BlackAContractPrice


If QuoteBreakDown.tbBlackASection1Weight.Value < "" Then
QuoteForm.Range("A" & DataRow).Value = "Black Uncoated " &
QuoteBreakDown.tbBlackASection1Description.Text
If Wizard.obShowWeights = True Then
QuoteForm.Range("E" & DataRow).Value = "Approximately"
With QuoteForm.Range("G" & DataRow)
.Value =
ThisWorkbook.Worksheets("Calculations").Range("Bla ckASection1Weight").Text &
" lbs @ "
.HorizontalAlignment = xlRight
End With
End If
If Wizard.obUnit = True Then
With QuoteForm.Range("H" & DataRow)
.Value = "$" &
Format(ThisWorkbook.Worksheets("Calculations").Ran ge("BlackAContractPricePerPound").Value * 100, "##.#0") & " / cwt"
.HorizontalAlignment = xlRight
End With
End If
If Wizard.obLump = True Then
With QuoteForm.Range("H" & DataRow)
.Value = "$" &
ThisWorkbook.Worksheets("Calculations").Range("Bla ckAContractPrice").Value
.HorizontalAlignment = xlRight
End With
End If
DataRow = DataRow + 1
End If