ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   selecting a dynamic range (https://www.excelbanter.com/excel-programming/337492-selecting-dynamic-range.html)

Alan M

selecting a dynamic range
 
Hi I have a spreadsheet in which one column speficies the days in the year.
The adjacent columns then contain recorded data. On selection of this sheet
the cell adjacent to today's date is selected.

I need code to highlight data the range from F7 to w7 and down to the row
above the active cell.
I.E. All data which is ' in the past'

The problem I have is that the active cell row changes daily and so the size
of the required range changes as well.

Karthik Bhat - Bangalore

selecting a dynamic range
 
Hi Alan

This code will do the job

Sub SelectData()
Row = ActiveCell.Row - 1
Range(Cells(7, 6), Cells(Row, 23)).Select
End Sub


Thanks
Karthik Bhat



All times are GMT +1. The time now is 03:20 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com