+ Reply to Thread
Results 1 to 9 of 9

Problem finding the value of the column of the active cell on the cuent sheet

  1. #1
    Registered User
    Join Date
    10-27-2015
    Location
    Georgia
    MS-Off Ver
    2008
    Posts
    11

    Question Problem finding the value of the column of the active cell on the cuent sheet

    My code is:

    Please Login or Register  to view this content.
    The problem I am experiencing is when the program reaches the while loop. The conditions And (ActiveCell.Column) < e and (ActiveCell.Column) >= e Are mis-triggering it is as if the conditions is not evaluated at all or (ActiveCell.Column) >= e is all ways true which it is not).

    Originally I wrote the code from the while loop down. The code as shown worked. After I was requested that the code/ability include the capability to copy an entire sheet from another workbook to the workbook where the macro is hosted, the top part of the code was added.

    The problem I think arises since the code is set to run on the 2nd sheet the 17th column, Q, is not 17 as assumed. Is there a way to:

    1 to alter the syntax of (ActiveCell.Column) < e So it knows I am trying to refer to 17th column on the second/last/active sheet?

    2 Or make it so the value of e always refers to 17th column on the current sheet?

    thanks
    lconner

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Problem finding the value of the column of the active cell on the cuent sheet

    Change the "and" to "or" as nothing could satisfy both conditions
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Registered User
    Join Date
    10-27-2015
    Location
    Georgia
    MS-Off Ver
    2008
    Posts
    11

    Re: Problem finding the value of the column of the active cell on the cuent sheet

    Sorry that dose not make since to me. the second condition test for the value of the active cell while the third condition is to test for the postilion of the active cell. how are they exclusive each other? and that still dose not explain why the code worked before the code to add the second sheet was added. What I need is the syntax to test the position of the active cell in a workbook with mutable worksheets. also sheets are to be consistently added the syntax needs to account for this.

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Problem finding the value of the column of the active cell on the cuent sheet

    Well - I'm confused - You're activating "A1" so that's always the activecell???

  5. #5
    Registered User
    Join Date
    10-27-2015
    Location
    Georgia
    MS-Off Ver
    2008
    Posts
    11

    Re: Problem finding the value of the column of the active cell on the cuent sheet

    I am not always activating the A cell, just testing it value. you can test a value of a cell with out that cell being, the active one. the active cell dose change as the loop repeats its self.

  6. #6
    Registered User
    Join Date
    10-27-2015
    Location
    Georgia
    MS-Off Ver
    2008
    Posts
    11

    Re: Problem finding the value of the column of the active cell on the cuent sheet

    does any one have an answer?

  7. #7
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Problem finding the value of the column of the active cell on the cuent sheet

    Maybe:

    Try removing the parentheses:

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    10-27-2015
    Location
    Georgia
    MS-Off Ver
    2008
    Posts
    11

    Re: Problem finding the value of the column of the active cell on the cuent sheet

    Sorry that dose not work. Any other ideas?

  9. #9
    Registered User
    Join Date
    10-27-2015
    Location
    Georgia
    MS-Off Ver
    2008
    Posts
    11

    Re: Problem finding the value of the column of the active cell on the cuent sheet

    Could some at least point me to a good source on this. I tried searching for it and nothing come up.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Finding max value of column in a non-active sheet.
    By DogOfAllTrades in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-19-2014, 02:12 PM
  2. Highlighting Active Cell/Column/Row Problem
    By Statto in forum Excel General
    Replies: 1
    Last Post: 10-18-2014, 12:08 PM
  3. Replies: 2
    Last Post: 10-05-2014, 04:10 PM
  4. [SOLVED] Finding current active row and write column A:s value in cell D3
    By a94andwi in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-03-2014, 05:00 PM
  5. Finding the last used cell in the active column and paste copied data
    By Megatronixs in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 11-18-2013, 09:59 AM
  6. How do I Check value of Active cell against column of vaules in another sheet
    By b1ackcr0w in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-25-2012, 06:41 PM
  7. [SOLVED] Copy from active sheet and paste into new sheet using info from cell in active
    By Ingve in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-23-2006, 06:00 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1