+ Reply to Thread
Results 1 to 2 of 2

Refresh Cell macro

  1. #1
    Forum Contributor
    Join Date
    10-18-2010
    Location
    Walla Walla, Washington
    MS-Off Ver
    Excel 2007
    Posts
    124

    Refresh Cell macro

    I have a cell A1 in my estimate sheet that does a concatenate of values entered in the estimate for and places these values in the header of several different sheet (proposal, ....yada yada)..Every time I enter the job number in the cell in the estimate form, it populates to that value in to the concatenate of cell A1. The only problem is that I have to physically select cell A1 in the estimate and press enter on my keyboard to get the action to submit to each page in the header. I want to have a button where I can push that will refesh, so to speak, distributing this formula across my pages. Here is what I currently have. (someone here helped me with this 3 years ago. )


    Sub HeaderRefresh()

    Private Sub Worksheet_Change(ByVal Target As Range)

    Dim ws As Worksheet
    Dim strHeader As String

    If Target.Cells.Count > 1 Then Exit Sub

    If Target.Address = "$A$1" Then
    If Target <> vbNullString Then
    strHeader = Range("A1").Value
    For Each ws In ThisWorkbook.Worksheets
    With ws.PageSetup
    .CenterHeader = strHeader
    End With
    Next ws
    End If
    End If
    End Sub
    End Sub

    (Sorry, I don't know how to attach code in VB form.) I want to use this code with the appropriate modification to allow for a push of a button to execute cell A1. Thanks for any help.

  2. #2
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Refresh Cell macro

    Edit: Oops, I didn't even notice your code wasn't in tags. I shouldn't have responded until it is corrected. Edit your post, highlight the code, then press the # button in the text editor.

    Insert an ActiveX button (Developer Tab > Controls > Insert) then put your code inside the _Click sub for that button, like below. Make sure the sub is named to match your button's name.

    btw, i'm not sure why your code shows a sub in a sub, but that's not allowed.


    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 to refresh Essbase data sets, display refresh date?
    By nellaneb in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-17-2014, 03:59 PM
  2. Replies: 4
    Last Post: 11-20-2013, 10:32 AM
  3. Replies: 0
    Last Post: 01-07-2013, 08:39 PM
  4. Replies: 4
    Last Post: 05-30-2012, 02:40 AM
  5. Enable Auto Refresh - Wait for refresh to sinish before running a macro
    By tomlancaster in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-21-2011, 11:52 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