elbekomme.
Nedenstående skal IKKE i MODULE men ind i det ARK hvor du har din tabel.
Marker ark - højreklik på fanen - Vis koder. Indsæt nedenstående, dvs. en af
de 2.
Jeg ville bruge den første.
Bemærk iøvrige, at du i arket øverst til højre har en "masse" events som du
kan se nærmere på, når tiden er moden.
Option Explicit
'Ved ændring af celler i range: DATA
Private Sub Worksheet_Change(ByVal Target As Range)
'Column
Dim AreaCells As Range
Set AreaCells = Range("Data")
If Intersect(Target, AreaCells) Is Nothing Then Exit Sub
Dim x As Long
For x = 1 To AreaCells.Columns.Count
Dim cell As Range
For Each cell In AreaCells.Offset(0, x - 1) _
.Resize(AreaCells.Rows.Count, 1)
cell.Select
Next cell
Next x
Set AreaCells = Nothing
' 'Row
' Dim AreaCells As Range
' Set AreaCells = Range("Data")
'
' If Intersect(Target, AreaCells) Is Nothing Then Exit Sub
'
' Dim cell As Range
' For Each cell In AreaCells
' cell.Select
' Next cell
'
' Set AreaCells = Nothing
End Sub
'Ved markering af celle i range: DATA
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'Column
Dim AreaCells As Range
Set AreaCells = Range("Data")
If Intersect(Target, AreaCells) Is Nothing Then Exit Sub
Application.EnableEvents = False
Dim x As Long
For x = 1 To AreaCells.Columns.Count
Dim cell As Range
For Each cell In AreaCells.Offset(0, x - 1) _
.Resize(AreaCells.Rows.Count, 1)
cell.Select
Next cell
Next x
Application.EnableEvents = True
Set AreaCells = Nothing
' 'Row
' Dim AreaCells As Range
' Set AreaCells = Range("Data")
'
' If Intersect(Target, AreaCells) Is Nothing Then Exit Sub
'
' Application.EnableEvents = False
' Dim cell As Range
' For Each cell In AreaCells
' cell.Select
' Next cell
' Application.EnableEvents = true
'
' Set AreaCells = Nothing
End Sub
--
Med venlig hilsen
Jørgen Bondesen
"Mike Johnson" <powerviper4@hotmail.com> wrote in message
news:0p3h615e7a3h9rgo2ni78pdqfhqrl41k48@4ax.com...
> Tak
>
> Jeg fik det til at virke. Endnu engang tak for hjælpen
>
> Har dog lige endnu et spg
>
> Pt. skal jeg starte makroen vha. en knap, men kunne godt tænke mig at
> den blev triggeret automatisk når man har rettet noget (eller måske
> bare ved at checke værdien i en celle):
>
> Fx.
>
> =if(D17>500;testCOLUM();"")
>
> Men når jeg prøver ovenstående, får jeg fejlen at "navnet er ugyldigt"
>
> Mvh MJ