Selecting a block of cells depending on the values of two others
Closed
jwilson28
Posts
3
Registration date
Friday 21 April 2017
Status
Member
Last seen
5 December 2017
-
21 Apr 2017 à 06:53
TrowaD Posts 2921 Registration date Sunday 12 September 2010 Status Contributor Last seen 27 December 2022 - 25 Apr 2017 à 12:09
TrowaD Posts 2921 Registration date Sunday 12 September 2010 Status Contributor Last seen 27 December 2022 - 25 Apr 2017 à 12:09
Related:
- Based on the values in cells b77 b81
- Based on the values in cells b77 - Excel Forum
- Based on the values in cells b77 b81 what function can automatically return the value in cell c77 ✓ - Excel Forum
- Based on the values in cells b77 b81 c77 - Excel Forum
- Based on the values in cells b77:b81, which function can automatically return the value in cell c77? ✓ - Excel Forum
- How do I get a value in a cell based on another cell - Excel Forum
3 responses
Try this. Record your Macro, and view it (edit it). Then change the part of the macro you want to have be dynamic. Post back if you have any questions.
OK, that is a start then. Thanks for you posting back!
Initilize a variable, call it a "ARANGE", and set it as a RANGE.
Set ARANGE to "A50:C50"
now, utilize it as RANGE(ARANGE).select
Try that. You can then set ARANGE to what ever variable (range, cell) you wish!
Initilize a variable, call it a "ARANGE", and set it as a RANGE.
Set ARANGE to "A50:C50"
now, utilize it as RANGE(ARANGE).select
Try that. You can then set ARANGE to what ever variable (range, cell) you wish!
TrowaD
Posts
2921
Registration date
Sunday 12 September 2010
Status
Contributor
Last seen
27 December 2022
555
25 Apr 2017 à 12:09
25 Apr 2017 à 12:09
Or try this:
When your active cell is C4 and you add 4 rows you get row 8.
When you add 5 to column C (=3) you will get column H (=8).
So when A50=4 and C50=5 and C4 is active cell, then selected range after macro is run, will be C4 to H8.
Best regards,
Trowa
Sub RunMe()
ActiveCell.Resize(Range("A50").Value + 1, Range("C50").Value + 1).Select
End Sub
When your active cell is C4 and you add 4 rows you get row 8.
When you add 5 to column C (=3) you will get column H (=8).
So when A50=4 and C50=5 and C4 is active cell, then selected range after macro is run, will be C4 to H8.
Best regards,
Trowa
22 Apr 2017 à 08:10
I have the code
Sub Select6()
Range(ActiveCell(1, 1), ActiveCell(6, 6)).Select
This code highlights a a block of 6 rows and 6 columns to the right of the active cell
I am struggling to replace the numbers so rather than highlighting the number of cells that are in the code it highlights number of cells from the the values in cells A50 and C50
Jon