![]() |
Column Offset
This should be a simple fix for you guys!
After i go "xlDown", how do i maintain the same cell range in the C column when i move over one column? In Excel, i would do the following... in Starting in D6... Ctrl+Shft+Dwn, Shft+Left+Tab+Lft how do i translate into code? eg. "xlDown" in the below code highlights D6:D?... Now i want the same range highlighted in column C =, not D. Range("D6").Select Range(Selection, Selection.End(xlDown)).Select Range("C6:C1260").Select ExcelJockey *** Sent via Developersdex http://www.developersdex.com *** |
Column Offset
This should work
Range(Selection.Offset(0, -1), Selection.End(xlDown).Offset(0, -1)).Select "Kirill V" wrote: This should be a simple fix for you guys! After i go "xlDown", how do i maintain the same cell range in the C column when i move over one column? In Excel, i would do the following... in Starting in D6... Ctrl+Shft+Dwn, Shft+Left+Tab+Lft how do i translate into code? eg. "xlDown" in the below code highlights D6:D?... Now i want the same range highlighted in column C =, not D. Range("D6").Select Range(Selection, Selection.End(xlDown)).Select Range("C6:C1260").Select ExcelJockey *** Sent via Developersdex http://www.developersdex.com *** |
Column Offset
Hi
Selection.Offset(0,-1).Select But don't use select unless it is needed. The code below is doing what your are trying to do: Dim FirstCell As Range Set FirstCell = Range("D6") Set TargetRange = Range(FirstCell, FirstCell.End(xlDown)) TargetRange.Offset(0, -1).Select Hopes this helps. --- Per "Kirill V" skrev i meddelelsen ... This should be a simple fix for you guys! After i go "xlDown", how do i maintain the same cell range in the C column when i move over one column? In Excel, i would do the following... in Starting in D6... Ctrl+Shft+Dwn, Shft+Left+Tab+Lft how do i translate into code? eg. "xlDown" in the below code highlights D6:D?... Now i want the same range highlighted in column C =, not D. Range("D6").Select Range(Selection, Selection.End(xlDown)).Select Range("C6:C1260").Select ExcelJockey *** Sent via Developersdex http://www.developersdex.com *** |
Column Offset
This worked great, thanks guys!
ExcelJockey *** Sent via Developersdex http://www.developersdex.com *** |
All times are GMT +1. The time now is 02:53 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com