Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Unfortunately, after years of time "pouring thru trying to understand code" I
can't seem to do the simpliest of things. Here's an example... In a new WB - Sheet1 I enter into each cell B10:F10 x then I run this code and I get "INVALID QUALIFIER" with .Count << highlighted WHY??? Seems like cell F10 would get selected, but no,,,,,,, Damn this stuff!! Sub test() ActiveSheet.Cells(10, Columns.Count.End(xlToLeft)).Select End Sub |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I think I'd do it this way
Dim aWS as worksheet set aWS = activesheet aWS.Cells(10, aws.Columns.Count).End(xlToLeft).Select -- HTH, Barb Reinhardt If this post was helpful to you, please click YES below. "JMay" wrote: Unfortunately, after years of time "pouring thru trying to understand code" I can't seem to do the simpliest of things. Here's an example... In a new WB - Sheet1 I enter into each cell B10:F10 x then I run this code and I get "INVALID QUALIFIER" with .Count << highlighted WHY??? Seems like cell F10 would get selected, but no,,,,,,, Damn this stuff!! Sub test() ActiveSheet.Cells(10, Columns.Count.End(xlToLeft)).Select End Sub |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Barb,
Thanks I see the most blatant part of my error, that is of not enclosing my Cells() reference before using the ".end..." Excel 101 << one of the many days I skipped that class I changed it to: (without incident - works great!! - Is it necessary to use the reference to aWS? If so, why? Sub test() ActiveSheet.Cells(10, Columns.Count).End(xlToLeft).Select End Sub Again thanks Jim "Barb Reinhardt" wrote: I think I'd do it this way Dim aWS as worksheet set aWS = activesheet aWS.Cells(10, aws.Columns.Count).End(xlToLeft).Select -- HTH, Barb Reinhardt If this post was helpful to you, please click YES below. "JMay" wrote: Unfortunately, after years of time "pouring thru trying to understand code" I can't seem to do the simpliest of things. Here's an example... In a new WB - Sheet1 I enter into each cell B10:F10 x then I run this code and I get "INVALID QUALIFIER" with .Count << highlighted WHY??? Seems like cell F10 would get selected, but no,,,,,,, Damn this stuff!! Sub test() ActiveSheet.Cells(10, Columns.Count.End(xlToLeft)).Select End Sub |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi,
You have a bracket in the wrong place. ActiveSheet.Cells(10, Columns.Count).End(xlToLeft).Select Cheers Andy JMay wrote: Unfortunately, after years of time "pouring thru trying to understand code" I can't seem to do the simpliest of things. Here's an example... In a new WB - Sheet1 I enter into each cell B10:F10 x then I run this code and I get "INVALID QUALIFIER" with .Count << highlighted WHY??? Seems like cell F10 would get selected, but no,,,,,,, Damn this stuff!! Sub test() ActiveSheet.Cells(10, Columns.Count.End(xlToLeft)).Select End Sub -- Andy Pope, Microsoft MVP - Excel http://www.andypope.info |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I'd use a couple of lines to make it easier to understand:
Option Explicit Sub test() Dim LastCol As Long With ActiveSheet LastCol = .Cells(10, .Columns.Count).End(xlToLeft).Column .Cells(10, LastCol).Select End With End Sub JMay wrote: Unfortunately, after years of time "pouring thru trying to understand code" I can't seem to do the simpliest of things. Here's an example... In a new WB - Sheet1 I enter into each cell B10:F10 x then I run this code and I get "INVALID QUALIFIER" with .Count << highlighted WHY??? Seems like cell F10 would get selected, but no,,,,,,, Damn this stuff!! Sub test() ActiveSheet.Cells(10, Columns.Count.End(xlToLeft)).Select End Sub -- Dave Peterson |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
hi
are you trying to select the row b10 to f10? try this ActiveSheet.Range("B10", Range("B10").End(xlToRight)).Select regards FSt1 "JMay" wrote: Unfortunately, after years of time "pouring thru trying to understand code" I can't seem to do the simpliest of things. Here's an example... In a new WB - Sheet1 I enter into each cell B10:F10 x then I run this code and I get "INVALID QUALIFIER" with .Count << highlighted WHY??? Seems like cell F10 would get selected, but no,,,,,,, Damn this stuff!! Sub test() ActiveSheet.Cells(10, Columns.Count.End(xlToLeft)).Select End Sub |
#7
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
No, was just trying to find and select only cell F10.
Thanks Thanks for the code I see where your code does select the full range; Good to know.. Jim "FSt1" wrote: hi are you trying to select the row b10 to f10? try this ActiveSheet.Range("B10", Range("B10").End(xlToRight)).Select regards FSt1 "JMay" wrote: Unfortunately, after years of time "pouring thru trying to understand code" I can't seem to do the simpliest of things. Here's an example... In a new WB - Sheet1 I enter into each cell B10:F10 x then I run this code and I get "INVALID QUALIFIER" with .Count << highlighted WHY??? Seems like cell F10 would get selected, but no,,,,,,, Damn this stuff!! Sub test() ActiveSheet.Cells(10, Columns.Count.End(xlToLeft)).Select End Sub |
#8
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
hi
well i tried. sorry of the confusion. Regards FSt1 "JMay" wrote: No, was just trying to find and select only cell F10. Thanks Thanks for the code I see where your code does select the full range; Good to know.. Jim "FSt1" wrote: hi are you trying to select the row b10 to f10? try this ActiveSheet.Range("B10", Range("B10").End(xlToRight)).Select regards FSt1 "JMay" wrote: Unfortunately, after years of time "pouring thru trying to understand code" I can't seem to do the simpliest of things. Here's an example... In a new WB - Sheet1 I enter into each cell B10:F10 x then I run this code and I get "INVALID QUALIFIER" with .Count << highlighted WHY??? Seems like cell F10 would get selected, but no,,,,,,, Damn this stuff!! Sub test() ActiveSheet.Cells(10, Columns.Count.End(xlToLeft)).Select End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Drop Down/List w/Code and Definition, only code entered when selec | Excel Worksheet Functions | |||
Convert a Number Code to a Text Code | Excel Discussion (Misc queries) | |||
Code expantion , with code! | Excel Discussion (Misc queries) | |||
Unprotect Code Module in Code | Excel Discussion (Misc queries) | |||
copying vba code to a standard code module | Excel Discussion (Misc queries) |