Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

VBA Excel - What cell does this refer to?

Posted on 2014-01-17
9
Medium Priority
?
507 Views
Last Modified: 2014-01-17
Hi,
I have some moderate knowledge of VBA - not great tho!

I am trying to fix something for a colleague.
At this moment, I cannot upload the sheet onto EE.

Specifically, I need help with the following line;

If (Sheet1.DTBox2.Value - Sheet1.DTBox.Value < 0) Then

I understand that it is comparing two dates etc.
However, where do I find the value for Sheet1.STBox2.value ?

1. Should I be looking in some cell on sheet1?
2. Should I be looking in the "Names Manager"?
3. The workbook is fairly complex and perhaps there are external links
0
Comment
Question by:Patrick O'Dea
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 52

Accepted Solution

by:
Rgonzo1971 earned 1200 total points
ID: 39788136
Hi,

Look for a TextBox Control

You can use this to see the names of all shapes ( and controls )

This should help
Sub macro()
For Each sht In ActiveWorkbook.Sheets
    sht.Activate
    For Each shp In sht.Shapes
        shp.Select
        MsgBox shp.Name
   Next
Next
End Sub

Open in new window

Regards
0
 
LVL 3

Assisted Solution

by:Sreeram
Sreeram earned 400 total points
ID: 39788171
Hi

 its refering to a  control in the sheet1.

To check the control:

1.Select Page Layout in the menubar.
2.under Arrange group.
3.Select selection pane (it will provide you all the controls used in the sheet).
0
 

Author Comment

by:Patrick O'Dea
ID: 39788261
Great ... making progress and found the text box.

However, the textbox has a value of =EMBED("MSComCtl2.DTPicker.2","")


This is obviously referring to a date somewhere.

I am unfamiliar with "EMBED" ..... can you explain
 =EMBED("MSComCtl2.DTPicker.2","")

Thanks again!
0
Industry Leaders: 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!

 

Author Comment

by:Patrick O'Dea
ID: 39788275
Thanks folks,


.... making progress!

I have found the textbox and it has a value of

=EMBED("MSComCtl2.DTPicker.2","")

Next question!  What does this mean??  It obviously points to a date field ... but I am unfamiliar with EMBED
0
 
LVL 27

Assisted Solution

by:MacroShadow
MacroShadow earned 400 total points
ID: 39788276
Ignore it, your are not meant to see it at all, it's an internal excel function. stackoverflow.com/questions/9373348/what-does-embed-function-mean-in-excel-controls
0
 
LVL 52

Expert Comment

by:Rgonzo1971
ID: 39788280
HI,

=EMBED("MSComCtl2.DTPicker.2","")

is not is value but the control itself the value is what you should see in it a date because it's a datepicker control
the value is extracted in vba with the "DTBox.Value" part

Regards
0
 

Author Comment

by:Patrick O'Dea
ID: 39788302
Rgonzo,

Thanks but a final query?

the value is extracted in vba with the "DTBox.Value" part


I am sure you are correct but how does "DTBox.Value" relate to =EMBED("MSComCtl2.DTPicker.2","")

Perhaps this is too difficult to answer without displaying the actual spreadsheet.

What do you think?
0
 
LVL 52

Expert Comment

by:Rgonzo1971
ID: 39788331
Hi,

DT Box is the name of the control

Here with an example wit another Control named TextBox2

And this snippet
Sub macro()
MsgBox Sheet1.TextBox2.Name & ": " & Sheet1.TextBox2.Value
End Sub

Open in new window

Regards
ControlTest.xlsm
0
 

Author Closing Comment

by:Patrick O'Dea
ID: 39788353
Thanks ... I have made progress but not solved everything!

I will return to this later!
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question