View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jake Marx[_3_] Jake Marx[_3_] is offline
external usenet poster
 
Posts: 860
Default Query on Control Source in Userform Textbox

Hi Golf,

[[[If ("Data_Entry_Sheet!B75") "" Then
Sheet8.PrintOut]]]


You forgot to tell VBA that you wanted to deal with a Range. So your code
is comparing the string "Data_Entry_Sheet!B75" with an empty string (""),
and the previous will always be greater than the latter.

Instead, you could use:

If Len(Sheets("Data_Entry_Sheet").Range("B75").Value) Then

This will force a printout only if cell B75 on Data_Entry_Sheet has a value.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


golf4 wrote:
Hi, everybody -

BOY O' BOY --- I continue to improve our agency's Income Calculation
Tool with the help of numerous people here. I have a slight problem in
one of my VB codings. My particular problem is related to the portion
of the code that is seperated and in brackets. I have created a
specific userform that includes a number of textboxes where the user
enter data that feeds over to the spreadsheet's Data Entry Sheet. The
Data Entry Sheet then calculates the family's income and rent whish
then feeds over to all of the applicable program letters and
worksheets.

Within the userform, I have a data entry textbox with the Control
Source set to enter the data entered into the textbox to feed into the
field Data_Entry_Sheet!B75. What's supposed to happen is: if
Data_Entry_Sheet!b75 is populated, via the userform's textbox,
Worksheet 8 should be printed out - if the field is empty, Worksheet 8
should not be printed. WHAT IS HAPPENING --- everytime I run the code,
even when Data_Entry_Sheet!b75 is empty, the worksheet prints out!!!

Sorry for the extended query. I'm hoping one of the experts here can
give me a clue why this is happening and how I can fix the code.

CODE BELOW:

<snip

[[[If ("Data_Entry_Sheet!B75") "" Then
Sheet8.PrintOut]]]

<snip