Do not use on any
shared computer
August 29, 2008 08:08pm pdt
 
[x]
Attachment Details

Excel Macro when clicked update button in one sheet needs to start the query and check multiple sheets

Tags: Excel, macro
Hi,

Excel Macro when clicked update button in one sheet needs to start the query and check multiple sheets

I have a excel workbook which has 5 sheets and each sheet is having different data with 10+ colums and 1000+ rows.

The main 3 sheets are
1. Desktops
2. Stock
3. DCS = Desktop converted servers.

I need one sheet that gets the data thats called " All Data"
Attached is the sheet that has the headers.
The All data sheet should get all data from Colum S where there is "Rental" mentioned with all the other 4 colums data .

When ever clicked update it has to check all the sheets for any changes...


Hope i could explain correctly...

Regards
Sharath
Start your free trial to view this solution
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

Question Stats
Zone: Software
Question Asked By: bsharath
Solution Provided By: RobSampson
Participating Experts: 2
Solution Grade: A
Views: 38
Translate:
Loading Advertisement...
 
[+][-]Author Comment by bsharath
Author Comment by bsharath:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by c_pop
Expert Comment by c_pop:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by bsharath
Author Comment by bsharath:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by RobSampson

Rank: Wizard

Expert Comment by RobSampson:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by bsharath
Author Comment by bsharath:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by RobSampson

Rank: Wizard

Expert Comment by RobSampson:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by bsharath
Author Comment by bsharath:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by RobSampson

Rank: Wizard

Expert Comment by RobSampson:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by bsharath
Author Comment by bsharath:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Accepted Solution by RobSampson

Rank: Wizard

Accepted Solution by RobSampson:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by bsharath
Author Comment by bsharath:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by bsharath
Author Comment by bsharath:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by bsharath
Author Comment by bsharath:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by RobSampson

Rank: Wizard

Expert Comment by RobSampson:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Open Discussion
Open Discussion
 
Comment by bsharath
Thanks Rob this works great...My Boss just said that wants to become a member in EE for your help....

Thanks a lot....
 
 
Comment by RobSampson
Ha ha.....he can just ask questions through you....LOL.

Rob.
 
 
Comment by bsharath
:-)
 
 
Comment by bsharath
Rob sorry 1 more thing..

There are many sheets in the file.
The macro is even taking data from another sheets.
Can you make it mandatory that it wueries just the 3 sheets

The main 3 sheets are
1. Desktops
2. Stock
3. DCS
 
 
Comment by RobSampson
This should work. Change this line:
If objSheet.Name <> "All Data" Then

to
If objSheet.Name = "Desktops" Or objSheet.Name = "Stock" Or objSheet.Name = "DCS" Then

Regards,

Rob.
 
 
Comment by bsharath
Thanks Rob...
 
 
Comment by bsharath
Rob What is the code i can use with this macro to autofit all cells and even put borders for all the range of details available.
As everytime the data is deleted and updated..
 
 
Comment by bsharath
Rob What is the code i can use with this macro to autofit all cells and even put borders for all the range of details available.
As everytime the data is deleted and updated..
 
 
Comment by RobSampson
Where you have this:
    For Each objSheet In ActiveWorkbook.Sheets
        If objSheet.Name = "Desktops" Or objSheet.Name = "Stock" Or objSheet.Name = "DCS" Then
            For intRow = 2 To objSheet.Cells(65536, "S").End(xlUp).Row
                If objSheet.Cells(intRow, "S").Value = "Rental" Then
                    ActiveWorkbook.Sheets("All Data").Cells(intAllRow, "A") = intAllRow - 1
                    ActiveWorkbook.Sheets("All Data").Cells(intAllRow, "B") = objSheet.Cells(intRow, "T").Value
                    ActiveWorkbook.Sheets("All Data").Cells(intAllRow, "C") = objSheet.Cells(intRow, "Q").Value
                    ActiveWorkbook.Sheets("All Data").Cells(intAllRow, "D") = objSheet.Cells(intRow, "P").Value
                    ActiveWorkbook.Sheets("All Data").Cells(intAllRow, "E") = objSheet.Cells(intRow, "K").Value
                    ActiveWorkbook.Sheets("All Data").Cells(intAllRow, "F") = objSheet.Cells(intRow, "E").Value
                    intAllRow = intAllRow + 1
                End If
            Next
        End If
    Next

change it to:

    For Each objSheet In ActiveWorkbook.Sheets
        If objSheet.Name = "Desktops" Or objSheet.Name = "Stock" Or objSheet.Name = "DCS" Then
            For intRow = 2 To objSheet.Cells(65536, "S").End(xlUp).Row
                If objSheet.Cells(intRow, "S").Value = "Rental" Then
                    ActiveWorkbook.Sheets("All Data").Cells(intAllRow, "A") = intAllRow - 1
                    ActiveWorkbook.Sheets("All Data").Cells(intAllRow, "B") = objSheet.Cells(intRow, "T").Value
                    ActiveWorkbook.Sheets("All Data").Cells(intAllRow, "C") = objSheet.Cells(intRow, "Q").Value
                    ActiveWorkbook.Sheets("All Data").Cells(intAllRow, "D") = objSheet.Cells(intRow, "P").Value
                    ActiveWorkbook.Sheets("All Data").Cells(intAllRow, "E") = objSheet.Cells(intRow, "K").Value
                    ActiveWorkbook.Sheets("All Data").Cells(intAllRow, "F") = objSheet.Cells(intRow, "E").Value
                    intAllRow = intAllRow + 1
                    Columns.EntireColumn.AutoFit
                              Range("A1:F" & intAllRow).Borders(xlDiagonalDown).LineStyle = xlNone
                            Range("A1:F" & intAllRow).Borders(xlDiagonalUp).LineStyle = xlNone
                            With Range("A1:F" & intAllRow).Borders(xlEdgeLeft)
                                .LineStyle = xlContinuous
                                .Weight = xlThin
                                .ColorIndex = xlAutomatic
                            End With
                            With Range("A1:F" & intAllRow).Borders(xlEdgeTop)
                                .LineStyle = xlContinuous
                                .Weight = xlThin
                                .ColorIndex = xlAutomatic
                            End With
                            With Range("A1:F" & intAllRow).Borders(xlEdgeBottom)
                                .LineStyle = xlContinuous
                                .Weight = xlThin
                                .ColorIndex = xlAutomatic
                            End With
                            With Range("A1:F" & intAllRow).Borders(xlEdgeRight)
                                .LineStyle = xlContinuous
                                .Weight = xlThin
                                .ColorIndex = xlAutomatic
                            End With
                            With Range("A1:F" & intAllRow).Borders(xlInsideVertical)
                                .LineStyle = xlContinuous
                                .Weight = xlThin
                                .ColorIndex = xlAutomatic
                            End With
                End If
            Next
        End If
    Next


Regards,

Rob.
 
 
Comment by bsharath
Thanks Rob this works great... :-)
 
 
Comment by bsharath
Thanks Rob this works great... :-)
 
 
20080723-EE-VQP-34 / EE_QW_EXPERT_20070906