Refresh of single sheet in  a workbook

Hi all,
I have a workbook with 5 sheets and each sheet has 2 different queries. Users want to have a refresh button on each sheet, so that when they click on refresh button only that sheet should be refreshed. I know this can be done using VBA but does anyone have the code which does this functionality?
Thanks in advance.

Hi Hansa,
    Here is what you need to do.
1) Place a Button on Each Sheet that you would like to Refresh.
2) On Each button Place the Following Code.
    Me.Select
   ' Cell from the first Query.
    Range("B2").Activate
    Run "SAPBEX.XLA!SAPBEXrefresh", False
   'Cell in the Second Query
   Range("AA2").Activate
   Run "SAPBEX.XLA!SAPBEXrefresh", False
   'So on for all the Queries on that Sheet.
You can add some Error Handling if you need to.
If you use
Run "SAPBEX.XLA!SAPBEXrefresh", True
Then all Queries will be refreshed so I think you will have to do the above.
If you Really want this to be Dynamic where in every time you add a Query to the Sheet you don't want to change the Code then here is my Suggestion.
'Do this when the sheet is setup.
'On the Button of Each Sheet
Private Sub CommandButton1_Click()
          Send the Sheet Name to a Generic Code in a Module
         'Here the Row Number is a Cell Where you can add all
         ' the Ranges for that Sheet.
' e.g. on a Hidden Sheet
' Cell A5 for Sheet 1 looks like Below
' B2, Z2, A100
' Indicates that Sheet1 has 3 Queries Starting on Cell B2, A100
         Call RefreshSheet("Sheet1",5 )
End Sub
' In a Module Create this
Public Sub RefreshSheet(ByVal sSheet As String, ByVal iRow As Integer)
    'Assumptions: There is a Sheet called Update.
    'Cells have Starting Cell of Each Query in Rows. Column "A"
    On Error GoTo Err_RefreshSheet
    Dim arrCells() As String
    Dim wks As Worksheet
    Dim iLoop As Integer
        Set wks = ThisWorkbook.Worksheets(sSheet)
        'Here Update is my Hidden sheet and Row, 1 is the Cells that holds Ranges
        arrCells = Split(ThisWorkbook.Sheets("Update").Cells(iRow, 1), ",")
        'Activate the Sheet that needs to be refreshed.
        wks.Activate
        'This will Loop on all the Cells where there is Query and Refresh it.
        For iLoop = 0 To UBound(arrCells)
           wks.Range(arrCells(iLoop)).Activate
           Run "SAPBEX.XLA!SAPBEXrefresh", False
        Next
Exit_RefreshSheet:
    Set wks = Nothing
    Exit Sub
Err_RefreshSheet:
    MsgBox "There Following Error in RefreshSheet" & vbCrLf & _
           Err.Description
    Err.Clear
    Resume Exit_RefreshSheet
End Sub
This way when you add a new Query on  Any Sheet all you do is go to Update Sheet and on the Line for the Sheet with new Query Add the Cell to Comma seperated Values.
The Code is Almost there, you will have to tweak it a bit.
Hope this Helps. !!
Datta.

Similar Messages

  • How can I print multiple pictures on a single sheet?

    Today 3/27/2012 I tried downloading HP software that says it has a new feature that allows printing multiple pictures on a single sheet of photopaper.  The download started and halted at only one square and sat there flashing for hours, meaning it wasn't downloading on my Pavilion desktop computer.  Since it's a new feature (apparently), no wonder no one as yet has asked this question and so I doubt if anyone has the answer.  But, I'll wait to see.

    You are probably going to get help by posting in the iPhoto forum. You can easily locate it by clicking on Apple Support Discussions on the top left of this page then navigating to the iPhoto forums.
    Roger

  • Refreshing a single portlet rather than the whole portal page

    Ok, here's my situation.
    I have two pdk portlets on my portal that communicate through page parameters. Portlet A has a bunch of search fields, a customer drop-down list, parts drop-down list, division, etc. Portlet B takes those parameters, queries the database, and displays the results. I would like to be able to refresh portlet B without reloading the whole portal page.
    I have onchange events on all of my drop-downs that will do a javascript post back to portal, which will in turn set my page parameters, and I see there is a 'refreshPortlet' function in a javascript file that portal provides that will refresh a single portlet based on a portletReferenceId. It is normally called when a refresh button is clicked in the portlet header, but I don't see any reason I can't call it after my javascript post, that is, if I had the portletReferenceId for the other portlet. I thought about making a hidden html table on the page that, I could fill with the portlet names and ids for each portlet as they load, that way I could reference that list from any portlet. The problem is I can't figure out where the ids are coming from. Based on the code behind the button, the function is looking for something like this 646_701285_646_1_701271, but the closest thing I can come up with is this 676114_POSTCONTENTPORTLET_467414915 which I got from PortletRenderRequest.getPortletInstance().getInstanceName(). As you can see, it's not even close. Does anyone know where the correct id could be coming from? It's got to be available to me somewhere, doesn't it?
    The only other option I can think of to accomplish my goal is to use straight up ajax to display portlet B, but that kind of defeats the purpose of portal doesn't it?
    Any help would be greatly appreciated.
    Thanks,
    Doug

    You can use Ctrl+F4 to close the current tab. I don't think that you can change the Alt+F4 action with Keyconfig.

  • Is it possible to enter events into a specific iCal calendar, then print a list of those events with the name and date on a single sheet?

    Is it possible to enter events into a specific iCal calendar, then print a list of those events with the name and date on a single sheet?  I don't need the calendar grid.  I just want a list of events on a particular calendar, and their dates.  Is that possible? 

    Not easily. Two possibilities:
    1) If all the events have some common feature (eg you have included "XXX" in all the summaries), search for that feature then select and copy the found items at the bottom of the window. You can then paste them into TextEdit or a spreadsheet for printing
    2) You could write an Applescript to locate the events and write them into a text file for printing.
    The first one will probably give you what you want.

  • Applescript: How do i loop a script between two sheets in one workbook?

    My office uses excel for its invoices and they have tasked me with finding a way to automatically name the invoice tabs in the workbook which are set up between two dummy sheets. What I have works but does not do exactly what they asked.
    This is what I have so far:
    tell application "Microsoft Excel"
              repeat with x in (get selected sheets of active window)
                        try
                                  set name of x to string value of range "T18" in ws
                        on error
                                  display dialog "Re-name failed" buttons {"Cancel"} with icon 0
                        end try
              end repeat
    end tell
    As of now I have to highlight the sheets in the workbook I want the script to run on. I would like to be able is to run the set name script between two sheets (Dummy 1 & Dummy 2) without having to highlight any scripts. I thought of using a from to with the repeat function but that has to be an integer. Any ideas would be welcome as at best I would call myself an ametuer with just enough knowledge to get in trouble.

    Ah, that is a little tricky.  try this instead.
    tell application "Microsoft Excel"
              tell workbook 1
                        set sheetHolder to sheet "Dummy 1"
                        repeat
      -- get next sheet
                                  set currentSheet to next of sheetHolder
      -- check for end sheet and exit
                                  if name of currentSheet is "Dummy 2" then exit repeat
      -- rename (exit on failure)
                                  try
                                            set name of currentSheet to string value of cell "T18" of currentSheet
                                  on error
                                            display dialog "Re-name failed" buttons {"Cancel"} with icon 0
                                            exit repeat
                                  end try
      -- crawl across sheets, inchworm style
                                  set sheetHolder to currentSheet
                        end repeat
              end tell
    end tell

  • Printing many checks on a single sheet

    Is it possible to print more than one check on a single piece of paper?
    The requirement is just to print cheques, and not provide address details or remittance details.
    has anyone done this before?
    Is there some logic that will stop this?

    Hi,
    Are you talking about printing duplicate check details on a single sheet or the original checks on a single sheet. Are you using the check stationery supplied from the Bank or is it somethng else.
    If you wish to print original checks on the pre printed stationery supplied by the bank, then you cannot print many checks on a single sheet
    But if you wish to print duplicate chekcs on a single sheet, you have to co ordinate with your abap consultant who can help you further. I am not sure if this can be possible as the checks are printed page wise.
    hope this helps
    regards,
    radhika

  • Printing multiple pages on a single sheet with SAPScript

    Hello,
    I am using SAPScript on ECC 6.0. We currently have a form which occupies the top half of an A4 sheet of paper. The form is printed on pre-printed stationary provided by the government. The government has now issued a new version of the pre-printed stationary which allows a single page to contain the form twice. The form is a with-holding tax receipt that we issue to a vendor.
    We now wish to use this stationary to print 2 different instances of the form to a single sheet. The different instances will be for different vendors and have different contents. The stationary is provided perforated so we can split them apart after printing.
    Does anyone know how to make SAPScript print 2 instances of a form to a single sheet of paper using a laser printer?
    Thanks in advance,
    Ben

    Hi Ben,
       Use this control command in the sap script main window and split the main window into two parts. This will solve your problem. If you require further info please let me know.
    /: NEW-WINDOW
    Use of this command is as described below.
    Each page can consist of up to 99 main windows. Each main window is assigned a consecutive identifying number (0..98), and the windows are filled in this order. This feature enables SAPscript to print labels and to output multi-column text. When one main window fills up, the next main window on that page is taken, if there is a next one. A page break is inserted after the last main window.
    You can use the NEW-WINDOW command to call the next main window explicitly, even if the current main window is not yet full.
    OR****************************************
    You can call this script control command through your printprogram after filling your first instance of main window using function module CONTROL_FORM.
    reward if helpful.
    Thanks & Regards,
    Kalyan.
    Edited by: Kalyan on Jan 4, 2008 9:50 AM

  • How to delete Individual sheet in a workbook

    How to delete a particular sheet in a workbook?

    One nice tip which might probably work:
    Activate Macro Recording and then delete the sheet manually. Stop recording and take a look into the script if there are any useful entries.
    Please note that i don't know if this works on deleting sheets, but this is a great approach for all ActiveX interactions with Office applications.
    hope this helps,
    Norbert
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.

  • DataGrid: Refresh one single row.

    How do I refresh one single row in FlashBuilder DataGrid?  I don't want to change the user's field sort order or selected row.

    I would suggest that you create a backup of the datagrid
    section of the code and then replace it with a datagrid where you
    are displaying the datafileds and are not using any itemrenderer.
    this way you will be able to identify if the itemrenderer is indeed
    causing the problem.
    Also, shouldn't you be binding the arraycolection in your
    dataprovider. the data provider for my datagrid is usually bound
    like
    <mx:DataGrid id="DateGrid" width="100%" height="100%"
    dataProvider="{shiftXLC}">
    where shiftXLC is xmlListcollection or in your case it would
    be the arraycollection.
    hope this helps.

  • Refresh of views/queries in a workbook

    Hi,
    I have a requirement to prepare a workbook with 5 views of the same query.
    I am looking for an effective method to have all 5 views refreshed when the user open the workbook. Is this possible? Is this possible to execute the refresh without the user intervention (ie passing the username, password and server to the workbook and have it refreshed automatically).
    Your suggestions are appreciated,
    Regards,
    Xibi

    Thanks Bhanu for the prompt reply, i wasn't sure if that setting refreshes all views (each in the different worksheet) in the workbook.
    And what about the automatic refresh of the workbook - is it possible?
    Message was edited by: xibi xibi

  • Keep recto/verso page placement when printing 'Multiple' pages on single sheet

    Dear All,
    my book is designed for duplex printing. Every chapter starts on recto (odd) page.
    When I need to print it for proofreading in the multiple mode (2 pages on single sheet), pages do not follow the original intent as the first page is placed on the verso page (left half of the sheet), not recto one (right half). I couldn't find any option to place the first page on the recto 'side' in the Print dialog.
    My current workaround is to place one blank page at the beginning of my PDF file.
    But I'd like to avoid this manual step in the future. Is there a more efficient way?
    Btw, it would be nice to add a single option for this into the Print dialog. It could be handy for everyone.
    What is the best place for such kind of feature request?
    Thanks, Jan

    have no idea about what is wrong on your machine.
    Here doing that I get a normal behavior:
    You may try:
    a - quit/close Numbers
    trash the preferences file:
    <bootVolume>:Users:<yourAccount>:Library:Preferences:com.apple.iWork.Numbers.pli st
    empty the trash
    restart Numbers.
    b - try to do the job from an other user account
    tell us how the beast behaves.
    Yvan KOENIG (from FRANCE samedi 31 mai 2008 14:47:07)

  • How to embed multiple Quries in a single sheet in Query Analyzer

    Hi Experts ,
    How can we embed mulple Quries in a single sheet of Query Analyzer.
    Regards,
    Chandra

    Hi Experts,
    Thanks for Quick response, now i want to  insert the chart for this queries , how can we do, after placing analysis grid, in properties-->Associated charts i selected the Graph chart check box even though its not appearing.
    Actually i inserted 4 queries in a single sheet for each query i need to place chart below it.
    please let me know how can i achive this.
    Thanks,
    Chandra
    Edited by: Chandra Gandla on Aug 25, 2010 8:55 PM

  • Feed a single sheet of different paper into input feeder without pulling entire tray out ?

    With windows xp, is there a way to feed a single sheet of different paper into the input feeder on 8600 plus, without having to pull entire tray out each time?
    This question was solved.
    View Solution.

    HI,
    No this function is not supported on this unit, some laserjets for example haven a priority feed slot, but this printer does not.
    Say "Thanks" by clicking the Kudos Star in the post that helped you.
    Although I work for HP my posts and replies are my own
    Please mark the post that solves your problem as "Accepted Solution"

  • How i can refresh a single rectangle?

    hi
    I have a grid of rectangle, each rectangle have a color and position. I whould like to refresh a single rectangle but not entire table.
    how I can do this?
    thanx in advance!
    ps: i make this but it does not work well:     
    public void paint(Graphics g){
    super.paint(g);
    repaint(myRect.getX(), myRect.getY(), myRect.getWidth(), myRect.getHeight());}

    1) Couldn't you wait even an hour for an answer?!
    2) repaint (...) does not belong in your paint(...) method. Put repaint(...) in your other code (not paint(...) nor update(...) where you realize that you need to make a visual change to your rectangular area. repaint(...) will cause update(...) to be called at some time in the future. It is in update(...) that you can perform your redrawing.
    3) If your rectangle is in a container with other components layered on top of it, you may need to invalidate() and validate().

  • Printing ibot results in single sheet insted of two sheets

    Hi Dues,
    Currently when we print(through printer) ibot report it is comming in two sheets but business needs to print in single sheet.
    Please suggest.
    Thanks,
    Raji.
    Edited by: 961446 on Mar 5, 2013 7:57 AM

    I've found the problem: pageIndex=0 gets called twice, and it does not print anything the first time around. But the method runs, causing nextItem to signal the end of processing (-1), and the second call to print() just returned NO_SUCH_PAGE.
    So:
    if(nextItem == -1 && pageIndex!=0) return NO_SUCH_PAGE;
    I still don't know if it will be called twice for all pages or some of the other pages.
    For others it may be a feature, but as for me, it's a bug, because it makes harder handling those situations, when the contents of a page depends on the previous one.

Maybe you are looking for

  • Itunes will not show up on the screen

    My Itunes is fully installed but after i first used it i couldn't access it again. I have tried to repair it and uninstall and reinstall it. Please Help!!!!

  • CRM Survey

    Hello Forum,    As per our  business scenario once the Interaction Record or a Complaint is created and saved the Survey is to be triggered and once the customer on receiving an survey URL the customer clicks on the survey link URL, submits his respo

  • Some Sales Doc No are missing in the CUBE.

    Hi Experts, The issue is , Data is coming from R/3 syatem to BW. Everyday data comes to BW. But the problem is, when I am compairing Some recocords are missing in BW ( CUBE ). I searched by the SALES DOCUMENT NO. Now I need to find the reason behind

  • Disabled addons have no "Remove" button - Mac

    A couple of addons were disabled after a recent upgrade. Now they have '''no "Remove" button''', even in safe mode, so I can't get rid of them. I have looked in the '''Library''', both for my own user area and the whole computer - under ''Mozilla'',

  • Running catpatch.sql hangs

    Hi, After I applied 9.2.0.8 patch set, I ran catpatch.sql. However, I noticed it hangs. I checked the alert<SID>.log , I see the following interesting line below: Completed: ALTER DATABASE OPEN MIGRATE Sat Jun 20 00:10:25 2009 Thread 1 cannot allocat