+ Reply to Thread
Results 1 to 3 of 3

Change Cell Value to create Summary Sheet

Hybrid View

vientotambo Change Cell Value to create... 04-14-2013, 03:27 PM
xladept Re: Simple Macro Task... need... 04-14-2013, 05:28 PM
FDibbins Re: Simple Macro Task... need... 04-14-2013, 06:11 PM
  1. #1
    Registered User
    Join Date
    04-14-2013
    Location
    Troncones, Mexico
    MS-Off Ver
    Excel 2010
    Posts
    4

    Change Cell Value to create Summary Sheet

    This may be very simple, but I'm new to macros and excel. I'm trying to figure out how to creat a macro that changes the cell location in the following formula from B9 to B10 and then moves down one cell and does the same, one hundred times...

    The first cell shows ='Guest 1'!$B$9 and it should read ='Guest 1'$B$10
    The next cell down shows ='Guest 2'!$B$9 and it should read ='Guest 2'$B$10

    The bigger picture is that I have an Excel file with one months worth of check-in sheets at our hotel (100 sheets) and I'm trying to make summary pages that display a guests information horizontally. I've already edited one column so that each cell shows the guest's names all the way down. But I would like a quicker way to drag the formulas over and then quickly switch all of the cell references. We'll see if anybody followed that. Thanks for any help you may offer.
    Last edited by vientotambo; 04-14-2013 at 07:18 PM.

  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: Simple Macro Task... need help

    Hi Vientotambo,

    There's probably an easier way but:

    Sub ChangeForm()
    Dim F, S As String, I As Integer, J As Integer
    F = ActiveCell.Formula: S = CStr(F)
    For I = Len(S) To Len(S) - 5 Step -1
    If Not IsNumeric(Mid(S, I, 1)) Then
    Exit For: End If: Next I
    J = Val(Right(S, Len(S) - I)): J = J + 1
    S = Left(S, I) & J
    ActiveCell = S: End Sub
    Copy the code to the clipboard
    Press ALT + F11 to open the Visual Basic Editor.
    Select Module from the Insert menu
    Type "Option Explicit" then paste the code into the white space under it.
    Press ALT + Q to close the code window.
    with the cell you want to change selected
    Press ALT + F8 then double click on ChangeForm

    If you want to run the whole column:

    Sub ChangeForm()
    Dim F, S As String, I As Integer, J As Integer
    If ActiveCell = "" Then Exit Sub
    F = ActiveCell.Formula: S = CStr(F)
    For I = Len(S) To Len(S) - 5 Step -1
    If Not IsNumeric(Mid(S, I, 1)) Then
    Exit For: End If: Next I
    J = Val(Right(S, Len(S) - I)): J = J + 1
    S = Left(S, I) & J
    ActiveCell = S
    ActiveCell.Offset(1, 0).Select
    ChangeForm
    End Sub
    Last edited by xladept; 04-14-2013 at 05:54 PM.
    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
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Simple Macro Task... need help

    Hi and welcome to the forum

    We would love to help you with your question, but 1st, in accordance with forum rule, please rename your thread to something more meaningful, that actually describes your problem.

    Because thread titles are used in searching the forum it is vital they be written to accurately describe your thread content or overall objective using ONLY search friendly key words. That is, your title used as search terms would return relevant results.

    Also, many members will look at a thread title, and if it is of interest to them, or it falls within their area of expertese, they might only open those threads.

    Look at it this way...if you typed that title into google, what would you expect to get back?
    To change a Title on your post, click EDIT on you're 1st post, then Go Advanced and change your title
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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