JaccoVis90
New Member
- Joined
- Oct 30, 2015
- Messages
- 34
Hallo guys,
I have a question.
For a project i want to make a total sheet where al the products from other Sheets are collected.
(To also deal with the other sheets i would, at this point, copy the loop and change the sheet name, (not all sheets need to be implemented))
In the "basic" sheets there are the products with underneed them specification.
In the row of the name of the product there is the total price which i need. (I hope it is understandible)
Is this code the best way to go?
Thanks in advance
I have a question.
For a project i want to make a total sheet where al the products from other Sheets are collected.
(To also deal with the other sheets i would, at this point, copy the loop and change the sheet name, (not all sheets need to be implemented))
In the "basic" sheets there are the products with underneed them specification.
In the row of the name of the product there is the total price which i need. (I hope it is understandible)
Is this code the best way to go?
Code:
Sub testtest()
Dim i As Integer
Dim counter As Integer
Dim j As Integer
Dim a As String
Dim b As String
i = ThisWorkbook.Sheets("Blad1").Range("B" & Rows.Count).End(xlUp).Row
counter = 1
MsgBox (i) 'it is just for testing
Do Until counter = i
If ThisWorkbook.Sheets("Blad").Range("A" & counter) = Empty Then
Else
j = ThisWorkbook.Sheets("Blad2").Range("A" & Rows.Count).End(xlUp).Row
ThisWorkbook.Sheets("Blad2").Range("A" & j + 1) = ThisWorkbook.Sheets("Blad1").Range("A" & counter).Value
ThisWorkbook.Sheets("Blad2").Range("B" & j + 1) = ThisWorkbook.Sheets("Blad1").Range("B" & counter).Value
ThisWorkbook.Sheets("Blad2").Range("C" & j + 1) = ThisWorkbook.Sheets("Blad1").Range("J" & counter).Value
End If
counter = counter + 1
Loop
MsgBox "Einde"
End Sub
Thanks in advance