Sandie1712
New Member
- Joined
- Aug 10, 2017
- Messages
- 33
Hi
First of all i am very very new to VBA and learnt some things from youtube and tried to develop a code out of that in which i expect my cells with yellow color and negative value to be multiplied by -1 after running the program but below cited isn't working could you pl look into it and provide the right solution.
Sub Colormultiplewithnegative()Dim negvalue As Integernegvalue = -1Dim last_value As Interiorlast_row = Range("a100000").End(xlUp).RowDim i As IntegerFor i = 1 To last_rowIf Cells(i, 1).Interior.Color = 65535 And Cells(i, i).Value = "<0" ThenCells(i, 1).Value = Cells(i, 1) * negvalueElseEnd Iflast_row = last_row + 1NextEnd Sub
Thanks!!
First of all i am very very new to VBA and learnt some things from youtube and tried to develop a code out of that in which i expect my cells with yellow color and negative value to be multiplied by -1 after running the program but below cited isn't working could you pl look into it and provide the right solution.
Sub Colormultiplewithnegative()Dim negvalue As Integernegvalue = -1Dim last_value As Interiorlast_row = Range("a100000").End(xlUp).RowDim i As IntegerFor i = 1 To last_rowIf Cells(i, 1).Interior.Color = 65535 And Cells(i, i).Value = "<0" ThenCells(i, 1).Value = Cells(i, 1) * negvalueElseEnd Iflast_row = last_row + 1NextEnd Sub
Thanks!!