Copy cell contents with VB

T

TheMilkGuy

Hi folks. I should start by saying that I understand VB on a
kindergarten level. :)

I have a column (A15 to A25) that I would like to repeat the input
from A15 all the way down to A25.

However, if I change the value at A20 I would like that new value to
continue to A25.

Sound do-able? If so, many many thanks!!

Craig
 
D

Don Guillett

Right click sheet tab>view code>copy paste this. Now when you change any
cell in a15 or below the value will goto all cells below it to row 25

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("a15:a25")) Is Nothing Then Exit Sub
Application.EnableEvents = False
Range(Cells(Target.Row, "a"), Cells(25, "a")).Value = Target
Application.EnableEvents = True
End Sub
 
T

TheMilkGuy

Don,

Thanks for the quick reply, but I'm getting an "Ambiguous name
detected: Worksheet_Change" error.

Any suggestions?

Thanks,
Craig
 
T

TheMilkGuy

Disregard! Thanks Don, I just put your formula in with one I got from
this group earlier today for time conversion.

All's well. Appreciate your help!

Cheers,
Craig
 
T

TheMilkGuy

Ugh - at the risk of hijacking my own thread... ;)

Here is your formula Don, modified for my worksheet:

If Intersect(Target, Range("D19:D27")) Is Nothing Then Exit Sub
Application.EnableEvents = False
Range(Cells(Target.Row, "D"), Cells(27, "D")).Value = Target
Application.EnableEvents = True

How can I modify this to do the exact same job on the E19:E27 range?
Like D19, I want E19 to start the flow.

I have tried several methods with no luck.

Thanks, <insert sheepish grin here>
Craig
 
D

Don Guillett

If not Intersect(Target, Range("D19:D27")) Is Nothing Then
Application.EnableEvents = False
Range(Cells(Target.Row, "D"), Cells(27, "D")).Value = Target
Application.EnableEvents = True
end if

If not Intersect(Target, Range("e19:e27")) Is Nothing Then
Application.EnableEvents = False
Range(Cells(Target.Row, "e"), Cells(27, "e")).Value = Target
Application.EnableEvents = True
end if

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(e-mail address removed)
Ugh - at the risk of hijacking my own thread... ;)

Here is your formula Don, modified for my worksheet:

If Intersect(Target, Range("D19:D27")) Is Nothing Then Exit Sub
Application.EnableEvents = False
Range(Cells(Target.Row, "D"), Cells(27, "D")).Value = Target
Application.EnableEvents = True

How can I modify this to do the exact same job on the E19:E27 range?
Like D19, I want E19 to start the flow.

I have tried several methods with no luck.

Thanks, <insert sheepish grin here>
Craig
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top