Insert value in a dynamic range

mark84

New Member
Joined
Jan 22, 2021
Messages
31
Office Version
  1. 2016
Platform
  1. Windows
Hi guys,
I'm looking for a solution to write a value, for example '300105', from the first blank cell in column "I" to the last blank cell in the same column, so that the last value in column "I" correspond to the last value of the other columns.
You can see the output I d want in the pic 'output'.
The range in column "I" is not fixed and can change every time, so I need a vba without using fixed cells.
Thanks in advance.


Regards,
Marco
 

Attachments

  • img22.PNG
    img22.PNG
    30.2 KB · Views: 4
  • output.PNG
    output.PNG
    33.1 KB · Views: 4

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Try this:
VBA Code:
Sub try_1()
Dim a As Long, n As Long
n = Range("I" & Rows.Count).End(xlUp).Row
a = Range("A" & Rows.Count).End(xlUp).Row
Range("I" & n + 1 & ":I" & a) = 300105
End Sub
 
Upvote 1
Solution
Try this:
VBA Code:
Sub try_1()
Dim a As Long, n As Long
n = Range("I" & Rows.Count).End(xlUp).Row
a = Range("A" & Rows.Count).End(xlUp).Row
Range("I" & n + 1 & ":I" & a) = 300105
End Sub
great job my friend!
Thank you so much ;)
 
Upvote 0

Forum statistics

Threads
1,217,358
Messages
6,136,094
Members
449,991
Latest member
IslandofBDA

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