Add data to dynamic range

gaudrco

Board Regular
Joined
Aug 16, 2019
Messages
203
I have a dynamic range that expands when I add new data(naturally). I would like to add code to a button that I have that will adddata to the range when the button is pressed. This is the line of code I amworking with:

Code:
[FONT="Calibri"]Sheets("Competitor OverviewData").Range("CompetitorsLOV").Offset(1, 0).Value =Range("C2").Value[/FONT]

My expectation for the code is that when the button ispressed, the text from cell “C2” will be added to the bottom of my dynamicrange called “CompetitorsLOV” which is located on sheet Competitor OverviewData.

Thanks!





 

Akuini

Well-known Member
Joined
Feb 1, 2016
Messages
2,478
Office Version
365
Platform
Windows
Try this:

Code:
With Sheets("CompetitorsLOV").Range("CompetitorsLOV")
.Offset(.Rows.Count).Resize(1) = Range("C2").Value
End With
 

gaudrco

Board Regular
Joined
Aug 16, 2019
Messages
203
Thank you that worked. I had to fix the sheet name because you had it the same as the range name but other than that, perfect :)
 

Akuini

Well-known Member
Joined
Feb 1, 2016
Messages
2,478
Office Version
365
Platform
Windows
Ah, sorry for the wrong sheet name.
You're welcome, I'm glad to help, & thank you for the feedback.:)
 

Forum statistics

Threads
1,085,538
Messages
5,384,307
Members
401,887
Latest member
Somesh

Some videos you may like

This Week's Hot Topics

Top