Setting row range

lateraldesign

New Member
Joined
Dec 7, 2016
Messages
1
Hi guys

I'm new to VBA and trying to set up a way in which an updated row in Excel (columns B to M) produces the date and time in rows O and P respectively. This all works absolutely fine with the code below. However I simply need to be able to do this from rows 6 upwards as there is other content in the first 5 rows not related to this and every time someone makes a change here the date and time and automatically entered.

How do I go about doing this?


Code:
Private Sub Worksheet_Change(ByVal Target As Range)    If Not Application.Intersect(Range("$B:$M"), Target) Is Nothing Then
       Range("O" & Target.Row).Value = Date
       Range("P" & Target.Row).Value = Now()
    End If
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Hi guys

I'm new to VBA and trying to set up a way in which an updated row in Excel (columns B to M) produces the date and time in rows O and P respectively. This all works absolutely fine with the code below. However I simply need to be able to do this from rows 6 upwards as there is other content in the first 5 rows not related to this and every time someone makes a change here the date and time and automatically entered.

How do I go about doing this?


Code:
Private Sub Worksheet_Change(ByVal Target As Range)    If Not Application.Intersect(Range("$B:$M"), Target) Is Nothing Then
       Range("O" & Target.Row).Value = Date
       Range("P" & Target.Row).Value = Now()
    End If

so to be sure I understand. This code works fine, but you just do not want it to do anything in rows 1 - 5, correct?

if that is true use this

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Target.Row <= 5 Then
        If Not Application.Intersect(Range("$B:$M"), Target) Is Nothing Then
           Range("O" & Target.Row).Value = Date
           Range("P" & Target.Row).Value = Now()
        End If
    End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,213,527
Messages
6,114,148
Members
448,552
Latest member
WORKINGWITHNOLEADER

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top