# Broken Worksheet



## JLouis (Dec 17, 2022)

I previously had this WB working and now it is broke. Not sure what I did, but userform9.label3 does not change to the activecell when selected in the worksheet. Would anyone have any thoughts on why this would occur? The msgbox shows the correct entry in the WS selection change event but a similar box shows blank in the WS calculation event.

Another note is that the userform updates correctly after making a 2nd selection on the WS. I need it to be immediate.


```
Private Sub Worksheet_Calculate()
           UserForm9.Label3.Caption = Sheets("QB").Range("b522").Value
```


```
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Set rng = ActiveCell
MsgBox rng
Sheets("qb").Range("b522") = rng
```


----------



## Flashbond (Dec 19, 2022)

I don't know how was your setup before but the code below should work:

```
Dim ActiveRng As Variant
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
  MsgBox Target
  ActiveRng = Target.Value 'or just ActiveRng = Target
End Sub
Private Sub Worksheet_Calculate()
  UserForm9.Label3.Caption = ActiveRng
End Sub
```


----------



## JLouis (Dec 19, 2022)

Thanks for the reply. I'll give it a look when I have a chance. I appreciate your time.


----------

