Solved

VBA Excel - What cell does this refer to?

Posted on 2014-01-17
9
470 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
9 Comments
 
LVL 49

Accepted Solution

by:
Rgonzo1971 earned 300 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 100 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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 100 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 49

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 49

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

ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

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…
Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

809 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