![]() |
Still stunbling thru code
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 |
Still stunbling thru code
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 |
Still stunbling thru code
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 |
Still stunbling thru code
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 |
Still stunbling thru code
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 |
Still stunbling thru code
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 |
Still stunbling thru code
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 |
Still stunbling thru code
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 |
All times are GMT +1. The time now is 09:52 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com