Select Case help
"Ramthebuffs"
wrote
: I'm running a macro that has a select case in it. Some of the cases
: have the same procedures. I was thinking I could just create another
: sub to call from the case to decrease repetitveness. The problem is I
: use cells from the case row in the calculations. Any ideas on how I
: can work this out?
:
: Dim cell As Range
: Lastrow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
:
: For Each cell In Range("M1:M" & Lastrow)
: Select Case cell.Value
:
: Case 5
: Call Calculatecells
:
: Case 5.5
: Call Calculatecells
:
: Case 6 7 8 10 etc etc
: Call Calculatecells
:
: end select
: next
:
: Sub calculatecells
:
: (1500+('cell AB value *10))/ 'cell W value
:
: --
: Ramthebuffs
Just pass the cell.row value to your sub
Dim cell As Range
Lastrow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
For Each cell In Range("M1:M" & Lastrow)
Select Case cell.Value
Case 5
CalculateCells cell.Row
Case 5.5
....
Sub CalculateCells(myRow as Integer)
....cells(myRow, 28).Value
Paul D
|