![]() |
XL2002 - I'm having a bad day!
My mind is blank today...
I have a cell containing a letter. I want to use the letter to reference a column. I then want to reference a column 2 columns to the right of the first column. Sounds easy, but as I said, I'm having a bad day. Here's what I have... Dim cell As Range For Each cell In Sheets("Lists").Range("A1:A5") my1stCol = cell.Value my2ndCol = my1stCol + 2 msgbox (my1stCol & " ... " & my2ndCol) Next Thanks in advance. Trevor Williams |
XL2002 - I'm having a bad day!
Use OFFSET
Sub useoffset() For Each c In Range("a1:a5") MsgBox c & "..." & c.Offset(, 1) Next c End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "Trevor Williams" wrote in message ... My mind is blank today... I have a cell containing a letter. I want to use the letter to reference a column. I then want to reference a column 2 columns to the right of the first column. Sounds easy, but as I said, I'm having a bad day. Here's what I have... Dim cell As Range For Each cell In Sheets("Lists").Range("A1:A5") my1stCol = cell.Value my2ndCol = my1stCol + 2 msgbox (my1stCol & " ... " & my2ndCol) Next Thanks in advance. Trevor Williams |
XL2002 - I'm having a bad day!
Try this...
my2ndCol = cell.Offset(, 2).Value -- Rick (MVP - Excel) "Trevor Williams" wrote in message ... My mind is blank today... I have a cell containing a letter. I want to use the letter to reference a column. I then want to reference a column 2 columns to the right of the first column. Sounds easy, but as I said, I'm having a bad day. Here's what I have... Dim cell As Range For Each cell In Sheets("Lists").Range("A1:A5") my1stCol = cell.Value my2ndCol = my1stCol + 2 msgbox (my1stCol & " ... " & my2ndCol) Next Thanks in advance. Trevor Williams |
XL2002 - I'm having a bad day!
Thanks guys that helps!
"Rick Rothstein" wrote: Try this... my2ndCol = cell.Offset(, 2).Value -- Rick (MVP - Excel) "Trevor Williams" wrote in message ... My mind is blank today... I have a cell containing a letter. I want to use the letter to reference a column. I then want to reference a column 2 columns to the right of the first column. Sounds easy, but as I said, I'm having a bad day. Here's what I have... Dim cell As Range For Each cell In Sheets("Lists").Range("A1:A5") my1stCol = cell.Value my2ndCol = my1stCol + 2 msgbox (my1stCol & " ... " & my2ndCol) Next Thanks in advance. Trevor Williams |
All times are GMT +1. The time now is 12:01 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com