![]() |
Selecting range
I have an Excel 2000 spreadsheet where C1 and D1 have
headings. Column C has contiguous data but the number of data rows changes. Sometimes it is 300, sometimes 322 and at yet others 600. (That is, C1:C601 has data). If C1:C601 have data, I would like to select D2:D601. In other words, I would like the starting point to be D2 and the end point to depend on how much data C contains. If someone can show me how to do this it would be greatly appreciated. If someone could show me how to select data based on the previous column (rather than limit it to C and D)that would be even more helpful. Thank you. --Indu |
Selecting range
See if this helps
Sub myarea() x = Cells(Rows.Count, "c").End(xlUp).Row Range(Cells(2, "d"), Cells(x, "d")).Select End Sub -- Don Guillett SalesAid Software "Indu Aronson" wrote in message ... I have an Excel 2000 spreadsheet where C1 and D1 have headings. Column C has contiguous data but the number of data rows changes. Sometimes it is 300, sometimes 322 and at yet others 600. (That is, C1:C601 has data). If C1:C601 have data, I would like to select D2:D601. In other words, I would like the starting point to be D2 and the end point to depend on how much data C contains. If someone can show me how to do this it would be greatly appreciated. If someone could show me how to select data based on the previous column (rather than limit it to C and D)that would be even more helpful. Thank you. --Indu |
Selecting range
Try this piece of code:
Range("C2").Select Range(Selection, Selection.End(xlDown)).Select Selection.Offset(0,1).Select Nikos -----Original Message----- I have an Excel 2000 spreadsheet where C1 and D1 have headings. Column C has contiguous data but the number of data rows changes. Sometimes it is 300, sometimes 322 and at yet others 600. (That is, C1:C601 has data). If C1:C601 have data, I would like to select D2:D601. In other words, I would like the starting point to be D2 and the end point to depend on how much data C contains. If someone can show me how to do this it would be greatly appreciated. If someone could show me how to select data based on the previous column (rather than limit it to C and D)that would be even more helpful. Thank you. --Indu . |
Selecting range
Don and Nikos thank you very much for your help. Both
versions work just the way I wanted it to. Thanks again. -----Original Message----- See if this helps Sub myarea() x = Cells(Rows.Count, "c").End(xlUp).Row Range(Cells(2, "d"), Cells(x, "d")).Select End Sub -- Don Guillett SalesAid Software "Indu Aronson" wrote in message ... I have an Excel 2000 spreadsheet where C1 and D1 have headings. Column C has contiguous data but the number of data rows changes. Sometimes it is 300, sometimes 322 and at yet others 600. (That is, C1:C601 has data). If C1:C601 have data, I would like to select D2:D601. In other words, I would like the starting point to be D2 and the end point to depend on how much data C contains. If someone can show me how to do this it would be greatly appreciated. If someone could show me how to select data based on the previous column (rather than limit it to C and D)that would be even more helpful. Thank you. --Indu . |
Selecting range
|
All times are GMT +1. The time now is 08:13 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com