Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 468
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,355
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 468
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,489
Default 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
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default 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


  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,942
Default 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

  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 468
Default 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

  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,942
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Drop Down/List w/Code and Definition, only code entered when selec Spiritdancer Excel Worksheet Functions 2 November 2nd 07 03:57 AM
Convert a Number Code to a Text Code Traye Excel Discussion (Misc queries) 3 April 6th 07 09:54 PM
Code expantion , with code! Arran Excel Discussion (Misc queries) 7 January 14th 07 01:05 AM
Unprotect Code Module in Code Damien Excel Discussion (Misc queries) 2 April 18th 06 03:10 PM
copying vba code to a standard code module 1vagrowr Excel Discussion (Misc queries) 2 November 23rd 05 04:00 PM


All times are GMT +1. The time now is 04:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"