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: 14
  • output.PNG
    output.PNG
    33.1 KB · Views: 12

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
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,224,824
Messages
6,181,187
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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