Column Offset

K

Kirill V

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 ***
 
J

JLGWhiz

This should work

Range(Selection.Offset(0, -1), Selection.End(xlDown).Offset(0, -1)).Select
 
P

Per Jessen

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top