textbox populated

Bernieg

Board Regular
Joined
Jan 1, 2009
Messages
147
Office Version
  1. 365
Platform
  1. Windows
Hi i have been stuck on this for hours

if check box is true & short_shift is empty & overtime_hrs is empty then
in a nutshell is what i am trying to achieve.
But can't get there

It did work partly when i stated & short_shft = ""
how do we signify = " any text/number "
'***************************************
Tick1 = checkbox , shortshift & overtime_hrs = textbox

If data_capture_sheet.tick1 = True And data_capture_sheet.short_shift = False And data_capture_sheet.overtime_hrs = False Then
Cells(r, 3) = "6am to 6pm"
Cells(r, 4) = "06:00"
Cells(r, 9) = "12:00"
Cells(r, 11) = "0:40"

Elseif after

Bernie
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Try:

Code:
If data_capture_sheet.tick1 = True And data_capture_sheet.short_shift = "" And data_capture_sheet.overtime_hrs = "" Then
 
Upvote 0
Hi Andrew
Yes i have tried that as well, but it falls down when short shift or overtime are populated.

But i kept trying ..the problem is possebly that i was dealing with 2 types of data
i.e true/false and data.

Bernie
Ps do you know how to format & validate textboxs as you can in a cell in a sheet.


errorflag = true
shortshift = true
if data_capture_sheet.short_shift = "" then
errorflag = false
If errorflag = false Then
If errorflag = false Then shortshift = false
end if
end if

errorflag = true
Overtime = true
if data_capture_sheet.overtime_hrs = "" then
errorflag = false
If errorflag = false Then
If errorflag = false Then overtime = false
end if
end if



If data_capture_sheet.tick1 = True And shortshift = false And overtime = False Then
Cells(r, 3) = "6am to 6pm"
Cells(r, 4) = "06:00"
Cells(r, 9) = "12:00"
Cells(r, 11) = "0:40"


elseif data_capture_sheet.tick1 = True And shortshift = true And overtime = False Then
Cells(r, 3) = "6am to"
Cells(r, 4) = "06:00"
Cells(r, 9) = data_capture_sheet.short_shift.text
Cells(r, 11) = "0:40
end if
 
Upvote 0
Where are the controls located?

Worksheet? Userform?

Also, where is the code located?
 
Upvote 0
The combobox & textbox are in a userform.
The code is a mudule, not the uersform module
 
Upvote 0
Why isn't the code in the userform module?

If it's not how are you trying to run/trigger it?
 
Upvote 0
The call up to run it is in the userform module.
if was to put in the userform would i just rename with a private suffix

Bernie
 
Upvote 0
Can you post the actual code?

Usually you would put code for this sort of thing in the userform module.

The subs probably be declared as Private but don't need to be, that's not really important anyway.

Something that is important is how/when you want the code to run.

eg Do you want to validate after all the values are entered, say before you put anything on a worksheet?
 
Upvote 0

Forum statistics

Threads
1,224,564
Messages
6,179,547
Members
452,925
Latest member
duyvmex

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