If Form Field is Empty/Blank, do not copy value labels to worksheet

pjbassdc

New Member
Joined
Jun 11, 2009
Messages
10
Hi All,

I have a userform that is copying entries into a log sheet. On the userform I have multiple fields that I am combining to place data in 1 cell on a worksheet. When I run my submit macro, I am recording the value labels from my code "mA L" and "mA R" even though I may not have any number value provided. ie, I didn't have a value on the userform.

I was hoping someone may be able to help me prevent the value labels from being passed on to the logsheet, if no number value accompanies it. I have a total of 12 possible entires. I may have 4 on the left, 3 on the right as an example.

Ideally, it should look something like this:

L2 12mA L, L2 20mA R
L4 23mA L
L5 15mA L, L5 25mA R
S1 20mA L, S1 14 mA R

Here is my code that brings it to my logsheet. Just not sure quite how to block the labels from coming over with no number value. I would imagine each line would need to be evaluated individually.

Code:
Cells(erow, 23) = cb_level1.Text & "  " & tb_level1l.Text & "mA L" & ", " & cb_level1.Text & "  " & tb_level1r.Text & "mA R" & vbCrLf _
& cb_level2.Text & "  " & tb_level2l.Text & "mA L" & ", " & cb_level2.Text & "  " & tb_level2r.Text & "mA R" & vbCrLf _
& cb_level3.Text & "  " & tb_level3l.Text & "mA L" & ", " & cb_level3.Text & "  " & tb_level3r.Text & "mA R" & vbCrLf _
& cb_level4.Text & "  " & tb_level4l.Text & "mA L" & ", " & cb_level4.Text & "  " & tb_level4r.Text & "mA R" & vbCrLf _
& cb_level5.Text & "  " & tb_level5l.Text & "mA L" & ", " & cb_level5.Text & "  " & tb_level5r.Text & "mA R" & vbCrLf _
& cb_level6.Text & "  " & tb_level6l.Text & "mA L" & ", " & cb_level6.Text & "  " & tb_level6r.Text & "mA R"

Thank you for what assistance you may be able to provide.

Patrick
 

Some videos you may like

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

Watch MrExcel Video

Forum statistics

Threads
1,123,514
Messages
5,602,089
Members
414,501
Latest member
mdhaumyu

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
Top