Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
finding last column from a target row
Set newtargcell = Range("A2")
Set newtargcell = targCell.End(xlRight) the last produces an error, shouldnt it find the last cell to the right of row2? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
finding last column from a target row
Thomas,
You probably defined an object "newtargcell" but you are calling "targcell" Try ... Set newtargcell = range("A2")..End(xlRight) Could you check already my feedback on previous question? Wkr, JP "thomas donino" wrote in message ... Set newtargcell = Range("A2") Set newtargcell = targCell.End(xlRight) the last produces an error, shouldnt it find the last cell to the right of row2? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
finding last column from a target row
What is targCell ?
row2 or Column 2 ? -- Jim Cone Portland, Oregon USA "thomas donino" wrote in message ... Set newtargcell = Range("A2") Set newtargcell = targCell.End(xlRight) the last produces an error, shouldnt it find the last cell to the right of row2? |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
finding last column from a target row
Sub testcol()
Set newtargCell = Range("A2") Set newtargCell = newtargCell.End(xlRight) Lastcolumn = newtargCell MsgBox "Last column is" & newtargCell End Sub is the correct code, but doesn't work "Jim Cone" wrote: What is targCell ? row2 or Column 2 ? -- Jim Cone Portland, Oregon USA "thomas donino" wrote in message ... Set newtargcell = Range("A2") Set newtargcell = targCell.End(xlRight) the last produces an error, shouldnt it find the last cell to the right of row2? |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
finding last column from a target row
Lastcolumn = newtargCell.column
"thomas donino" wrote in message ... Sub testcol() Set newtargCell = Range("A2") Set newtargCell = newtargCell.End(xlRight) Lastcolumn = newtargCell MsgBox "Last column is" & newtargCell End Sub is the correct code, but doesn't work "Jim Cone" wrote: What is targCell ? row2 or Column 2 ? -- Jim Cone Portland, Oregon USA "thomas donino" wrote in message ... Set newtargcell = Range("A2") Set newtargcell = targCell.End(xlRight) the last produces an error, shouldnt it find the last cell to the right of row2? |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
finding last column from a target row
Lastcolumn = newtargCell This sets Lastcolumn to the VALUE of newtargCell, NOT the column number of that cell. Try Lastcolumn = newtargCell.Column Cordially, Chip Pearson Microsoft Most Valuable Professional Excel Product Group, 1998 - 2009 Pearson Software Consulting, LLC www.cpearson.com (email on web site) On Sun, 16 Aug 2009 09:55:01 -0700, thomas donino wrote: Sub testcol() Set newtargCell = Range("A2") Set newtargCell = newtargCell.End(xlRight) Lastcolumn = newtargCell MsgBox "Last column is" & newtargCell End Sub is the correct code, but doesn't work "Jim Cone" wrote: What is targCell ? row2 or Column 2 ? -- Jim Cone Portland, Oregon USA "thomas donino" wrote in message ... Set newtargcell = Range("A2") Set newtargcell = targCell.End(xlRight) the last produces an error, shouldnt it find the last cell to the right of row2? |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
finding last column from a target row
You also need to change...
xlRight to xlToRight -- Jim Cone Portland, Oregon USA "thomas donino" wrote in message ... Sub testcol() Set newtargCell = Range("A2") Set newtargCell = newtargCell.End(xlRight) Lastcolumn = newtargCell MsgBox "Last column is" & newtargCell End Sub is the correct code, but doesn't work "Jim Cone" wrote: What is targCell ? row2 or Column 2 ? -- Jim Cone Portland, Oregon USA "thomas donino" wrote in message ... Set newtargcell = Range("A2") Set newtargcell = targCell.End(xlRight) the last produces an error, shouldnt it find the last cell to the right of row2? |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
finding last column from a target row
All fixed, thank you all for the help
"Jim Cone" wrote: You also need to change... xlRight to xlToRight -- Jim Cone Portland, Oregon USA "thomas donino" wrote in message ... Sub testcol() Set newtargCell = Range("A2") Set newtargCell = newtargCell.End(xlRight) Lastcolumn = newtargCell MsgBox "Last column is" & newtargCell End Sub is the correct code, but doesn't work "Jim Cone" wrote: What is targCell ? row2 or Column 2 ? -- Jim Cone Portland, Oregon USA "thomas donino" wrote in message ... Set newtargcell = Range("A2") Set newtargcell = targCell.End(xlRight) the last produces an error, shouldnt it find the last cell to the right of row2? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
selectin the whole column beside the target cell | Excel Programming | |||
Column Chart with Dynamix Target Zones | Charts and Charting in Excel | |||
Target line to a column chart? | Charts and Charting in Excel | |||
Target cell reference moves when target is cut and pasted | Excel Discussion (Misc queries) | |||
assigning formula to a target column | Excel Programming |