ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Selecting Previously Active Cell (https://www.excelbanter.com/excel-programming/303022-re-selecting-previously-active-cell.html)

Harald Staff

Selecting Previously Active Cell
 
Hi

Worksheet module code:

Private Sub Worksheet_Change(ByVal Target As Range)
Set UserForm1.MyCell = Target(1).Offset(0, 1)
Application.EnableEvents = False
UserForm1.Show
End Sub

Userform module code:

Option Explicit
Public MyCell As Range

Private Sub CommandButton1_Click()
Unload Me
End Sub

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
MyCell.Value = TextBox1.Text
Application.EnableEvents = True
End Sub

HTH. Best wishes Harald

"CDotWin" skrev i melding
...
How do I make the previously active cell, the current active cell after

running a subroutine in VB???

i.e. - I input "Tech" into cell C6 and press Enter (the active cell now

becomes cell C7), and a userform appears. I want the data entered into the
textboxes in the userform to appear in the cell D6.

Please HELP.... Thanks

- CDotWin




Harald Staff

Selecting Previously Active Cell
 
Glad to hear that. My implementation instructions wasn't among the most
detailed, so you're doing very well. Thanks for the feedback.

Best wishes Harald

"CTInt04" skrev i melding
...
Works like a charm!!!
Thanks!!!





All times are GMT +1. The time now is 09:34 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com