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

x
?
Solved

Excel Userform Initialize

Posted on 2015-01-20
5
Medium Priority
?
219 Views
Last Modified: 2015-01-20
The attached spreadsheet has a Userform that allows the User to scroll through the rows of data in the spreadsheet.

Trying to figure out how to have the user double click in a "Sub-System" cell (Column C) and have the Userform open to that row data. Currently the Userform opens to the first record, and the user has to scroll through rows to reach the row in question.
Tracker-Workbook.xlsm
0
Comment
Question by:DougDodge
[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
  • 3
  • 2
5 Comments
 
LVL 11

Expert Comment

by:Wilder1626
ID: 40560705
An example could be like below:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)

Dim Lastrow As Integer
Lastrow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row

Set Rng = Range("C6:C" & Lastrow)

If Not Intersect(Target, Rng) Is Nothing Then SubSystemDetail.Show

End Sub

Open in new window



If you want to be able to type in the cell with the Form open also, you use VbModeless:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, 

Dim Lastrow As Integer
Lastrow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row

Set Rng = Range("C1:C" & Lastrow)

If Not Intersect(Target, Rng) Is Nothing Then SubSystemDetail.Show VbModeless
End Sub

Open in new window

0
 

Author Comment

by:DougDodge
ID: 40560766
Double click opens the Userform, but it does not open it to the item that was double clicked on, it just opens the Userform.
0
 
LVL 11

Accepted Solution

by:
Wilder1626 earned 2000 total points
ID: 40560851
If you want to see a value from a cell in the userform, you can do this. example
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)

SubSystemDetail.txtSubSystem = Cells(Application.ActiveCell.Row, 3).Value
    SubSystemDetail.Show

End Sub

Open in new window


That would enter the value from the C column Cell into the txtSubSystem  textbox

You can put has many textbox as you needs
Ex:
SubSystemDetail.TexBox1= Cells(Application.ActiveCell.Row, 3).Value

SubSystemDetail.TexBox2= Cells(Application.ActiveCell.Row, 4).Value

Open in new window

0
 

Author Closing Comment

by:DougDodge
ID: 40560963
Works like a charm.....

Thanks.....
0
 
LVL 11

Expert Comment

by:Wilder1626
ID: 40560973
i'm glad i was able to help.
0

Featured Post

Office 365 Training for Admins - 7 Day Trial

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

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

Outline Suppose you have some simple text based data in Excel that you would like to display as a PowerPoint presentation. Of course it would be possible to write some fairly complex VBA code that created a new slide for each line of the Excel data…
The advancement in technology has been a great source of betterment and empowerment for the human race, Nevertheless, this is not to say that technology doesn’t have any problems. We are bombarded with constant distractions, whether as an overload o…
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …

688 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