Conflicting codes?

Mikal

Board Regular
Joined
Aug 31, 2015
Messages
73
I have code that puts data into columns depending on weather or not the check box is checked. I also have code that checks the value of the cell and re-checks the box if >0 I Can't seem to get both codes to work, whichever on I have first works but the other doesn't. If I switch the order then the other works. Any Ideas?
Code:
Purchased Component Costs
If CheckBox1.Value = True Then
   Cells(PartNumRow, 9).Value = Cells(PartNumRow, 2).Value
Else
   Cells(PartNumRow, 9).Value = 0
End If

If Cells(PartNumRow, 9).Value > 0 Then
    Cells(PartNumRow, 8).Value = 0
     
Else
   Cells(PartNumRow, 8).Value = Cells(PartNumRow, 7).Value
  
  End If
If Cells(PartNumRow, 9).Value > 0 Then
CheckBox1.Value = True
Else
CheckBox1.Value = False
End If
 
Last edited by a moderator:
The Red envelop is explained at the bottom of the forum page, red for hot topic
 
Upvote 0

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Thanks to everyone that took a look a this. Through a series or Trail and error I was able to figure this out. For anyone interest it turned out to be pretty easy. Here is what I ended up with.

Code:
If Cells(PartNumRow, 9).Value > 0 Then CheckBox1 = True

'Purchased Component Costs
If CheckBox1.Value = True Then
   Cells(PartNumRow, 9).Value = Cells(PartNumRow, 2).Value
Else
   Cells(PartNumRow, 9).Value = 0
End If
If Cells(PartNumRow, 9).Value > 0 Then
    Cells(PartNumRow, 8).Value = 0
   
Else
   Cells(PartNumRow, 8).Value = Cells(PartNumRow, 7).Value
End If
 
Upvote 0
now you have a solution. would you have asked the question differently ?
 
Upvote 0

Forum statistics

Threads
1,215,101
Messages
6,123,095
Members
449,095
Latest member
gwguy

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