I read somewhere that VBA is an object Oriented version of BASIC, but I can't seem to find out how to pass values into a function. For example, I just finished writing a program that took forever in VBA. I had to write it in a top down manner, in C++ I could have wrote three functions passed the values into them and been done in 15 min tops, Instead I did a lot of cutting and pasting and my code is very hard to debug since it is the same code over and over again. Can anyone help me, I have enclosed some sample code. (Ignore the asterisks)
'CREATE ****** COLUMN
Columns("O:O").Select
Selection.Insert Shift:=xlToRight
Range("O2").Select
ActiveCell.FormulaR1C1 = "*****"
Range("O3").Select
'CREATE ****** COLUMN
Columns("X:X").Select
Selection.Insert Shift:=xlToRight
Range("X2").Select
ActiveCell.FormulaR1C1 = "*******"
Range("X3").Select
'CREATE ****** COLUMN
Columns("O:O").Select
Selection.Insert Shift:=xlToRight
Range("O2").Select
ActiveCell.FormulaR1C1 = "*****"
Range("O3").Select
'CREATE ****** COLUMN
Columns("X:X").Select
Selection.Insert Shift:=xlToRight
Range("X2").Select
ActiveCell.FormulaR1C1 = "*******"
Range("X3").Select