vba question

flynpat46

New Member
Joined
Sep 24, 2018
Messages
11
Hi,
Please help..
I am having trouble finding right code for my project. There are three rows. The third rows is empty. I need vba to evaluate B1, if less than 0, put an X in C1. Repeat on down until there isn't a value in column B.
175
215
30
40
50
63
70
80
90
100
110
120
130
140
150
1616
1784
18185
<colgroup><col width="44" style="width: 33pt; mso-width-source: userset; mso-width-alt: 1609;"> <col width="43" style="width: 32pt; mso-width-source: userset; mso-width-alt: 1572;"> <col width="44" style="width: 33pt; mso-width-source: userset; mso-width-alt: 1609;"> <tbody> </tbody>
 
Hello,
I guess I should have just did this instead. In column E, starting at E4, if 0, then F4 will have an X.
 
Upvote 0

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Change the E4 to F4 & the 3 to 4
 
Upvote 0
Hello,
I wanted to put the full sheet up with X's to the right of the cell with the zero. I believe that we will need a loop to evaluate starting at E4 down until there isn't a value in the E column. Then do the same for columns G,I,K,M,O,and Q.
Thank you for you help and patiences.
CONTAINER # 31 S/T # S/T # S/T # S/T # S/T # S/T # S/T #
CONT. M8076L M8077C M8078G M8079A M8080F TOTAL
ITEM# PART # DESCRIPTION TOTAL TX SHIP MS SHIP CA SHIP GA SHIP AZ SHIP FL SHIP Hou SHIP LEFT
1 PART # DESCRIPTION 500 75 350 0 X 0 X 75 0 X 0 X 0
2 PART # DESCRIPTION 100 15 30 25 0 X 30 0 X 0 X 0
3 PART # DESCRIPTION 20 0 X 10 0 X 0 X 10 0 X 0 X 0
4 PART # DESCRIPTION 40 0 X 0 X 0 X 0 X 40 0 X 0 X 0
5 PART # DESCRIPTION 25 0 X 0 X 0 X 0 X 25 0 X 0 X 0
6 PART # DESCRIPTION 26 3 2 2 2 15 2 0 X 0
7 PART # DESCRIPTION 162 0 X 162 0 X 0 X 0 X 0 X 0 X 0
8 PART # DESCRIPTION 76 0 X 51 0 X 0 X 15 10 0 X 0
9 PART # DESCRIPTION 69 0 X 0 X 0 X 0 X 69 0 X 0 X 0
10 PART # DESCRIPTION 103 0 X 32 16 25 30 0 X 0 X 0
11 PART # DESCRIPTION 6 0 X 6 0 X 0 X 0 X 0 X 0 X 0
12 PART # DESCRIPTION 23 0 X 0 X 0 X 0 X 10 13 0 X 0
13 PART # DESCRIPTION 88 0 X 88 0 X 0 X 0 X 0 X 0 X 0
14 PART # DESCRIPTION 10 0 X 10 0 X 0 X 0 X 0 X 0 X 0
15 PART # DESCRIPTION 25 0 X 25 0 X 0 X 0 X 0 X 0 X 0
16 PART # DESCRIPTION 16 16 0 X 0 X 0 X 0 X 0 X 0 X 0
17 PART # DESCRIPTION 84 84 0 X 0 X 0 X 0 X 0 X 0 X 0
18 PART # DESCRIPTION 185 185 0 X 0 X 0 X 0 X 0 X 0 X 0
 
Upvote 0
Try
Code:
Sub AddX()
   Dim i As Long
   For i = 5 To 17 Step 2
      With Range(Cells(4, i + 1), Cells(Rows.Count, i).End(xlUp).Offset(, 1))
         .Value = Evaluate(Replace("if(@=0,""X"","""")", "@", .Offset(, -1).Address))
      End With
   Next i
End Sub
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,215,315
Messages
6,124,207
Members
449,147
Latest member
sweetkt327

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