none
scrollrow of multiple sheets RRS feed

  • Question

  • Hi,

    Please give me better option for this,

        Application.ScreenUpdating = False
        
        Worksheets(Array("TREAT1", "VAC2", "BREED3", "EXT4", "CTLH5", "SHP6", "LAB7", "SCST8", "AI9", "TR10")).Select
        
        ActiveWindow.ScrollRow = 41
        
        ActiveWorkbook.Sheets("TREAT1").Activate
        ActiveWindow.ScrollRow = 59
        ActiveWorkbook.Sheets("VAC2").Activate
        ActiveWindow.ScrollRow = 36
    ActiveWorkbook.Sheets("BREED3").Activate
        ActiveWindow.ScrollRow = 45
    ActiveWorkbook.Sheets("EXT4").Activate
        ActiveWindow.ScrollRow = 55

        ActiveWindow.ScrollRow = 117

        Application.ScreenUpdating = True

    Only individual sheet code works, array doesn't.

    Regards


    Sunday, August 7, 2016 1:40 PM

Answers

  • Hi drsantoshsinghrathore,

    it seems that at a time only one sheet can be active in Active window.

    so to scroll every sheet in workbook simultaneously you need to loop through the sheets in the Workbook.

    use the code below it will scroll all sheets.

    Sub demo2()
    Dim sht As Worksheet
    For Each sht In ActiveWorkbook.Worksheets
                sht.Activate
                ActiveWindow.ScrollRow = 41
        Next sht
    End Sub

    Regards

    Deepak


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, August 8, 2016 2:55 AM
    Moderator

All replies

  • You can help by providing an example file and also tell us what you want to accomplish.

    Best regards, George

    Sunday, August 7, 2016 3:35 PM
  • Hi George B. Summers,

    Thank you,

    I want sheets to scroll to a row in the sheet with vba code. If I use separate code for each sheet, Then it works. But this array doesn't.

    Regards


    Sunday, August 7, 2016 4:17 PM
  • You mean that you want to scroll in the VBA code of each sheet? Not in the sheets themselves?

    Best regards, George

    Sunday, August 7, 2016 4:22 PM
  • Sorry,

    Hi George B. Summers,

    Thank you,

    I want sheets to scroll to a row in the sheet with vba code. If I use separate code for each sheet, Then it works. But this array doesn't.

    Regards

    Sunday, August 7, 2016 4:41 PM
  • Not sure what you want to accomplish. Should all sheets scroll simultaneously when you click on one scroll list for one sheet?

    Best regards, George

    Sunday, August 7, 2016 5:02 PM
  • Hi drsantoshsinghrathore,

    it seems that at a time only one sheet can be active in Active window.

    so to scroll every sheet in workbook simultaneously you need to loop through the sheets in the Workbook.

    use the code below it will scroll all sheets.

    Sub demo2()
    Dim sht As Worksheet
    For Each sht In ActiveWorkbook.Worksheets
                sht.Activate
                ActiveWindow.ScrollRow = 41
        Next sht
    End Sub

    Regards

    Deepak


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, August 8, 2016 2:55 AM
    Moderator