VBA in a workbook

L

Luc Vandenhoeck

Hello
I got 10 identicle sheets in a workbook.
I wrote a program to search some data in 1 sheet. I put them in a varriable.
Now i want to totalize the same data in a different number of sheets. I want
the input by a box.
for ex: sheets 1,2 an other time sheets 1,5,8.
Can anyone help me???
THX



In dutch
Hoi
Ik heb 10 identieke (van struktuur) tabbladen in een excel werkboek.
Ik heb een routine geschreven om in een blad enkele gegevens op te halen in
varriabelen.
Nu wil ik via een inputbox aangeven welke tabbladen hij moet totaliseren.
Bijvoorbeeld: cijfers van 1,2; later weer 3,5,8 enz.
Wie kan me hierbij helpen dat hij dus niet de varriabelen wist en achter
elkaar naar de aangegeven tabbladen gaat.
Dank
 
A

Art

Hello
I got 10 identicle sheets in a workbook.
I wrote a program to search some data in 1 sheet. I put them in a varriable.
Now i want to totalize the same data in a different number of sheets. I want
the input by a box.
for ex: sheets 1,2 an other time sheets 1,5,8.
Can anyone help me???
THX

In dutch
Hoi
Ik heb 10 identieke (van struktuur) tabbladen in een excel werkboek.
Ik heb een routine geschreven om in een blad enkele gegevens op te halen in
varriabelen.
Nu wil ik via een inputbox aangeven welke tabbladen hij moet totaliseren.
Bijvoorbeeld: cijfers van 1,2; later weer 3,5,8 enz.
Wie kan me hierbij helpen dat hij dus niet de varriabelen wist en achter
elkaar naar de aangegeven tabbladen gaat.
Dank

Hi Luc

The following code cycles through all worksheets and looks for a value
identified by a variable in the code (in this case "a") and sums the
value one cell to its right.
Hopefully this will help.

Sub findIt()
Dim ws As Worksheet
Dim findIt As Long
Dim totalIt As Long
Dim varSearch As String


varSearch = "a"
findIt = 0
totalIt = 0

For Each ws In Worksheets
On Error GoTo skip:
findIt = ws.Cells.Find(varSearch).Offset(0, 1)
totalIt = totalIt + findIt
skip:
Next ws
MsgBox totalIt
Exit Sub

End Sub


Regards

Art
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top