Good evening,
I have 2 VBA codes that I use in one worksheet, these codes both refer to something that is transformed into cell A3.
These two codes I want to combine into one code. I also want to change the code so that it works instantly, even when something changes in a cell that
the formula refers to in cell A3. the contents of cell A3 changes by the date of today(). at a certain date, it uploads information from one sheet to another worksheet. but with the codes I have now, he does so only when I adjust cell A3, and then enter or click another cell.
these are the codes;
Code
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Set Target = Range("$A$3")
If Target = "" Then Exit Sub
On Error GoTo Badname
ActiveSheet.Name = Left(Target, 31)
Exit Sub
Badname:
MsgBox "Please revise the entry in A3." & Chr(13) _
& "It appears to contain one or more " & Chr(13) _
& "illegal characters." & Chr(13)
Range("$A$3").Activate
End Sub
en
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$3" Then
With GetObject(ThisWorkbook.Path & "\Best1.xlsm")
Range("C6:BF102") = .Sheets(Range("A3").Value).Range("C6:BF102").Value
.Close 0
End With
End If
End Sub
Display More
I hope someone caNn help me out.
Adile