+ Reply to Thread
Results 1 to 4 of 4

Set Cell Value based on Top Row (in viewport)

  1. #1
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Set Cell Value based on Top Row (in viewport)

    Hey all you geniuses!

    This may not be possible. I have a calendar where when you scroll down and click in a month, the value in D2 changes to the Month. This works fine but I am seeking a way to make the value change WITHOUT clicking in a cell, but rather just based on the top row shown in the viewport.
    Is this possible?

    I don't know if VBA can detect which row is in at the top of the users view or not. Basically my current macro has an "end row" variable for each month and it will change the cell when the user clicks in a cell below one of the variables. I could modify the variable to be stored by the viewport top row, if that's a thing.

    Edit: (Adding this after the fact, forgot to put that I know how to get the top row and last row of the viewport, using VisibleRange..but I just don't know how to pass that value while scrolling, rather than only after clicking or right clicking a cell. It may not be possible (would require updating whenever scrolling happens)

    Just for reference this is the code I am using now: (warning, it's not elegant..haha)

    Please Login or Register  to view this content.
    Thanks in advance as always.

    I don't think a sample is required, but I attached it anyway.
    Attached Files Attached Files
    Last edited by NewYears1978; 02-02-2023 at 05:50 PM.

  2. #2
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Set Cell Value based on Top Row (in viewport)

    Hi there,

    If (but only if!) you feel like a challenge, here's something courtesy of the late great Chip Pearson:


    Hope this helps.

    Regards,

    Greg M

  3. #3
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: Set Cell Value based on Top Row (in viewport)

    I do love a challenge I had read that page before or maybe right after posting. The issue is that it uses some code that I am not allowed to use for the company, they block it.

    I might try it out just for myself though for learning purposes

  4. #4
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Set Cell Value based on Top Row (in viewport)

    Hi again,

    Many thanks for your feedback and also for the (undeserved!) Reputation increase - much appreciated!

    Good luck with that challenge - it looks interesting.

    Best regards,

    Greg M

+ 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] Delete Rows based on cell value, highlight based on cell value and keep deleted data
    By jaredli in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 11-21-2020, 06:37 AM
  2. Replies: 0
    Last Post: 08-05-2020, 10:55 AM
  3. [SOLVED] VBA code to duplicate work sheet based on cell value and rename based on cell value
    By NASANASA in forum Excel Programming / VBA / Macros
    Replies: 51
    Last Post: 03-12-2020, 07:54 AM
  4. Replies: 6
    Last Post: 01-23-2018, 04:49 AM
  5. Color Cell Based on Specific Text in Other Cell and Sorting Based on Results
    By kre30a in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-24-2016, 07:51 PM
  6. Overlaying Cell "Viewport" Over Chart
    By rmex in forum Excel General
    Replies: 1
    Last Post: 01-07-2016, 03:54 PM
  7. Delete row based on cell FORMAT (color, font, etc) (not based on cell value)
    By trobey in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-12-2012, 10:39 AM

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