Vba help 1 line

Lukums

Board Regular
Joined
Nov 23, 2015
Messages
195
Hey guys...

This is going to be hard I think.

If Range("i" & i).Value >= 0 Then Range("P" & i).Value = "/1000"

What I'm TRYING to do is if values are found over 0 in column i then divide values from column i in column p
Obviously this code is wrong - As all it's doing is placing "/1000".

Is this tricky... or am I being silly...?

Thanks all...
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Like this?

If Range("i" & i).Value >= 0 Then Range("P" & i).Value = Range("i" & i).Value / 1000
 
Upvote 0
Hello Lukums,

We're assuming that you have your code wrapped in a For/Next loop, so perhaps:-


Code:
Sub Test()

Dim lr As Long: lr = Sheet1.Range("I" & Rows.Count).End(xlUp).Row

      For i = 1 To lr  '----> Change row number to suit.
      If Cells(i, 9).Value >= 0 Then
      Cells(i, 16).Value = Cells(i, 9).Value / 1000
      End If
Next i

End Sub

I hope that this helps.

Cheerio,
vcoolio.
 
Upvote 0

Forum statistics

Threads
1,214,983
Messages
6,122,582
Members
449,089
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top