Hi Guys,
Just wondered if I could have some help, I have a script that pulls a value from a database and pastes it into a cell (D1), with the cell value I am trying to divide it by a certain number depending on its value. Heres what I am trying to write in english:
Then create a new variable with the newly created number. Not really sure how to go about this so any help would be appreciated.
I trying to do this because the field in the database that I am trying to populate with the new number cannot accept a higher number than 999.
Cheers
B
Just wondered if I could have some help, I have a script that pulls a value from a database and pastes it into a cell (D1), with the cell value I am trying to divide it by a certain number depending on its value. Heres what I am trying to write in english:
Code:
Dim pieces As Integer
pieces = Sheets("sheet1").Range("D1").Value
If pieces > 999 Then divide by 2
elseif pieces > 1998 then divide by 3
elseif pieces > 2997 then divide by 4
elseif pieces > 3996 then divide by 5
elseif pieces > 4995 then divide by 6
elseif pieces > 5996 then divide by 7
elseif pieces <= do nothing
endif
Then create a new variable with the newly created number. Not really sure how to go about this so any help would be appreciated.
I trying to do this because the field in the database that I am trying to populate with the new number cannot accept a higher number than 999.
Cheers
B