auto numbering in previous cell based on enter adjacent cell using target cell

Hasson

Active Member
Joined
Apr 8, 2021
Messages
392
Office Version
  1. 2016
Platform
  1. Windows
Hello
I have headers in row10 and data starts from row11. I want when entering data in column B , then should autonumbering in column A 1,2,3 ....
just when fill in cell for column B then should fill in previous cell in column B using target range by sheet module .
thanks
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Hi, try this formula for cell A11
=IF(B11="","",ROW()-10)
Then drag the formula of cell A11 down.
 
Upvote 0
thanks
I don't say to want the formula !
did you read title of thread and my details?

using target cell​

target range by sheet module .
this means code in sheet module by use cell target .
 
Upvote 0
Please help me help you.
So if you enter any value in Column B starting in Row 11
You want "1" entered in in Range("A11")

And if you enter any value in Range("B12") you want "2" entered in Range("A12")

Is this correct?
And the script will be run to do this when you enter any value in Column B starting in Row 11
 
Upvote 0
Try this:
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 2 And Target.Row > 10 Then
Target.Offset(, -1).Value = Target.Row - 10
End If
End Sub
 
Upvote 1
@My Aswer Is This
I've found there is problem , if I press inside the cell without write any thing also will populate number in cell for column A despite of the pressed cell in column B still is empty , how could fix it ,please?
 
Upvote 0
@My Aswer Is This
I've found there is problem , if I press inside the cell without write any thing also will populate number in cell for column A despite of the pressed cell in column B still is empty , how could fix it ,please?
The script will only run if you enter a value in column B

Do not understand what you mean when you say.
A despite of the pressed cell in column B still is empty , how could fix it ,please?

If you mean when you press the spacebar?
Pressing the spacebar enters a space the script does not exclude spaces.

If you delete the value in column A and then decide to delete the value in column B the script shows this as a change and will again put a value in column A

Not sure how many other things you may want to do in column B and what the results you may want in column A

Not sure what this means:
You wrote:
I press

What does press mean?
 
Last edited:
Upvote 0

Forum statistics

Threads
1,216,084
Messages
6,128,728
Members
449,465
Latest member
TAKLAM

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