• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 645
  • Last Modified:

Determine if Excel TextBox is blank

Hello All, I am stumped. I have textbox's from many files that I'm working on pulling into a single document, the only issue I have is this. I need to have some vba code to check if the textbox is empty. When completed the main file will pull in data from up to four workbooks. I do not want to pull in an empty textbox and waste space on the page that will be printed. This will obviously not be a good looking finished product. I have attached a single department sheet with dummy data in it. Each department sheet allows them to populate up to a month of data in one sheet and when my main file opens the department sheet it pulls the textbox for todays date to Linked Textbox Sheet and imports it into the main file.
1 Solution
After this statement:
ActiveSheet.Shapes.Range(Array("TextBox " & Cells(2, "D").Value)).Select

You can examine Selection.Text; for example:
If Selection.Text <> "" Then
    ' handle non-empty text box
End If
JPIT DirectorAuthor Commented:
Thanks, I was stuck trying to get the same result with if Textbox 1 or whichever <>"" and it would not work. It's not very often I need to use the selection properties.

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now