+ Reply to Thread
Results 1 to 6 of 6

Moving a cell to a specific location based on date

  1. #1
    Registered User
    Join Date
    04-23-2024
    Location
    Monticelo, KY
    MS-Off Ver
    MS 365 Excel Version 2403
    Posts
    2

    Moving a cell to a specific location based on date

    Hello Everyone,
    First time post here so thanks in advance for everyone's contributions.

    I have a process that I thought would be simple, but I am struggling with it.

    I have a cell (B3) that contains the formula =WEEKNUM(B2) - displays the week number it currently is.

    I am trying to create a macro that will look at a number that is keyed into a cell (H6)
    When the macro is executed it:
    It grabs the number located in (H6)
    It looks at cell (B3) The week number it is
    Then it looks at a row of 52 Cells that contain 1 through 52 - for each week of the year. (P4) through (BO4)
    The macro will place the value it grabbed (H6) in the same column that matches the value in (b3) the number of week it currently is.

    I hope this was descriptive enough.

    While I have worked with Excel for decades, VB is new to me.
    Thanks a million, to anyone that can point me in the right direction.
    JDH

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,632

    Re: Moving a cell to a specific location based on date

    Such a code (handler of the worksheet change event) inserted in your worksheet module shall do the job:

    Please Login or Register  to view this content.
    (see the file, make sure macros are enabled)
    Attached Files Attached Files
    Best Regards,

    Kaper

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,496

    Re: Moving a cell to a specific location based on date

    If B3 contains a week number, and P4:BO4 contains the numbers 1 to 52, you should be able to use something like:

    Please Login or Register  to view this content.
    Cells(5, . . .) refers to Row 5
    Range("B3").Value has the week number, so we add 3 to it to refer to the correct week number column.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Registered User
    Join Date
    04-23-2024
    Location
    Monticelo, KY
    MS-Off Ver
    MS 365 Excel Version 2403
    Posts
    2

    Re: Moving a cell to a specific location based on date

    Kaper,
    Thanks a million for posting this!
    It is very close to what I am trying to achieve.
    Your Spreadsheet worked great.

    Just one missing piece, the macro should zero out the input cell and leave the value it moved in place.
    For example.
    Enter amount in (H6)
    Amount is moved to corresponding week.
    The amount in (H6) is reset to zero and the amount in the corresponding week stays the same as what was originally entered in (H6)

    I can't thank you enough for getting me this far.
    Thanks again,
    -Jeff Hall

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,496

    Re: Moving a cell to a specific location based on date

    Please Login or Register  to view this content.

  6. #6
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,632

    Re: Moving a cell to a specific location based on date

    try:
    Please Login or Register  to view this content.

+ 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. Macro based on Cell Data-Copy to Specific Location on Different Sheet
    By blackshag in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-26-2016, 06:57 AM
  2. [SOLVED] Code for moving the cell cursor in specific location
    By Hovoruha Octavian in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-21-2016, 01:00 PM
  3. Microsoft Date and Time Picker Control - Keeps Moving Location
    By iamspardacus in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-16-2015, 08:53 PM
  4. Moving chart location based on pivot table
    By greynolds80 in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 06-01-2015, 11:00 AM
  5. Save specific sheet to location based on contents of cell
    By KJL in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-30-2012, 08:08 AM
  6. Moving data to a variable location based on a cell value
    By EllandRoad Dave in forum Excel General
    Replies: 0
    Last Post: 02-02-2007, 01:58 PM

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