Hi,
The error is occuring because the code is trying to divide a range object by
1000 and not the values in that range. Using a single cell is OK because VBA
automatically uses the value when a single cell range is used.
If you want to use VBA here you would have to loop through each of the
values of the range. The following code works but not sure if it's THE best
method.
Dim rngStart As Range
Set rngStart = Range("C16:V16")
For Each rng In rngStart
rng.Offset(-12, 0) = (rng.Value) / 1000
Next rng
HTH,
Matt
"Monique" wrote:
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