Skip to content

Commit 4899d77

Browse files
authored
Dynamic cell VBA
By selecting a cell you can dynamically do something
1 parent 1d3f166 commit 4899d77

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Excel VBA - Dynamic cell.vb

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
2+
Dim current_cell As Range
3+
Dim current_cell_address As String
4+
Dim previous_cell As Range
5+
6+
Set previous_cell = Range("A1")
7+
8+
current_cell_address = ActiveCell.Address
9+
previous_cell.Value = current_cell_address
10+
11+
Set current_cell = Range(current_cell_address)
12+
13+
'current_cell.Cells.Interior.Color = RGB(43, 42, 78)
14+
'current_cell_value = current_cell.Value
15+
'current_cell.FormulaLocal = "=SUM(A1:A1)"
16+
'current_cell.Copy previous_cell
17+
End Sub

0 commit comments

Comments
 (0)