View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Harald Staff Harald Staff is offline
external usenet poster
 
Posts: 292
Default 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