Function SetValue(rng As Range, num)
With rng
.Value = num
With Range("IV65536")
.Value=1000
.Copy
End With
.PasteSpecial Paste:=xlValues, Operation:=xlDivide
Range("IV65536").ClearContents
End With
End Function
and call with
SetValue Range("C16:V16"), Sheets(gstrCMCMCost).Range("B4:U4")
--
HTH
RP
(remove nothere from the email address if mailing direct)
"Monique" wrote in message
...
How would i go about creating a function that could do this for any range?
"KL" wrote:
Hi Minique,
How about this:
With Range("C16:V16")
.Value = Sheets(gstrCMCMCost).Range("B4:U4")
With Cells(65536,256)
.Value=1000
.Copy
End With
.PasteSpecial Paste:=xlValues, Operation:=xlDivide
End With
Cells(65536,256).ClearContents
Regard,
KL
"Monique" wrote in message
...
I am programming in VB. I want to divide a range of cells by one
number,
i.e.
the code i have is:
Range("C16:V16") = (Sheets(gstrCMCMCost).Range("B4:U4") / 1000)
This produces an error - A Type mismatch error.
This way works when I do one cell at a time. However I need to be able
to
do
all ranges at once. Is this possible?
Thanks