Checkbox Data transferring into wrong sheet...

freeple

New Member
Joined
Jul 12, 2012
Messages
2
Hey all, I have a UserForm that contains checkboxes... the code attempts to transfer the data from the checkboxes to the first empty cell (in a certain column) in the Sheet named "Shipments"... yet when I enter the data... it always goes into the sheet which is active... not only the Shipments sheet... what am I doing wrong?

Code:
 'CHECKBOXESDim lRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Shipments")


'find first empty row in database
lRow = ws.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row


'Determine if checkboz is true or false and assing a value
With ws
  If CheckBox1.Value = True Then Cells(lRow, 14).Value = "Yes"
  If CheckBox1.Value = False Then Cells(lRow, 14).Value = "No"
 End With
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Welcome to the board.

It's because you didn't tell it to go to the Shipments sheet..

try

Rich (BB code):
With ws
  If CheckBox1.Value = True Then .Cells(lRow, 14).Value = "Yes"
  If CheckBox1.Value = False Then .Cells(lRow, 14).Value = "No"
End With
 
Last edited:
Upvote 0
Missing the dot!
Code:
  If CheckBox1.Value = True Then .Cells(lRow, 14).Value = "Yes"
  If CheckBox1.Value = False Then .Cells(lRow, 14).Value = "No"
 
Last edited:
Upvote 0

Forum statistics

Threads
1,216,091
Messages
6,128,775
Members
449,468
Latest member
AGreen17

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