Welcome to DU! The truly grassroots left-of-center political community where regular people, not algorithms, drive the discussions and set the standards. Join the community: Create a free account Support DU (and get rid of ads!): Become a Star Member Latest Breaking News Editorials & Other Articles General Discussion The DU Lounge All Forums Issue Forums Culture Forums Alliance Forums Region Forums Support Forums Help & Search

tiredtoo

(2,949 posts)
Tue Apr 13, 2021, 12:21 AM Apr 2021

is there a way to create a range of cells using a calculated value

In excel macro

example Range(b1: b(val(c41)).select
I know this isn't correct but if you know what i am trying to do, maybe you could tell me the correct way.
C41 has a value after all data is entered. the data changes weekly.

1 replies = new reply since forum marked as read
Highlight: NoneDon't highlight anything 5 newestHighlight 5 most recent replies
is there a way to create a range of cells using a calculated value (Original Post) tiredtoo Apr 2021 OP
I would just set a variable to that value. Foolacious Apr 2021 #1

Foolacious

(514 posts)
1. I would just set a variable to that value.
Tue Apr 13, 2021, 01:09 AM
Apr 2021

Something like this:


Dim nVal As Long
nVal = Range("C41:C41" ).Value
Range("B1:B" & nVal).Select


But if it's important to get it all into one line of code, you can do this, though it looks a bit opaque:


Range("B1:B" & Range("C41:C41" ).Value).Select
Latest Discussions»Culture Forums»Apple Users»is there a way to create ...