Solved

Excel Userform Initialize

Posted on 2015-01-20
5
192 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
  • 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 500 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Colored cell if an input text is contained in a given list 8 74
Excel formula 5 82
Best format for image notations in Book using Word 6 56
Excel 2010 Vlookup 4 27
As freelancing is becoming more and more common in the tech industry, certain obstacles are proving to be a challenge to those who are used to more traditional, structured employment. This article is meant to help identify such obstacles and offer a…
Today companies are subjected to more-and-more data, and it won't stop any time soon.  But there are obvious opportunities for reducing data, particularly data duplicated among companies.
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 viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

740 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