• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Copy Data to another sheet

jhon23

New Member
Hi there I have this code that pulls data from one sheet and copies it to another sheet it loops through the sheet until there's no more data.

it pulls data from:
67600
the end result of the code is the following:
67599

but I want to tweak the code that if under revised breaker I type the same breaker name it will group it as shown in the picture below.
67601



Code:
Dim lastrow2 As Long
Dim lastrow1 As Long


lastrow1 = pwbProject.Sheets("1.2 - TCC Coordination").Range("F" & pwbProject.Sheets("1.2 - TCC Coordination").Rows.Count).End(xlUp).Row
lastrow2 = 3
For i = 2 To lastrow1
If Len(pwbProject.Sheets("1.2 - TCC Coordination").Cells(i, 6).Value) > 0 Then
                'step through a lot of following columns for breaker settings changes
                  For j = 6 To 645 Step 5
                 If pwbProject.Sheets("1.2 - TCC Coordination").Cells(i, j).Value <> "" Then
                pwbProject.Sheets("1.3 - Breaker Settings").Cells(lastrow2, 1).Value = pwbProject.Sheets("1.2 - TCC Coordination").Cells(i, j).Value
                pwbProject.Sheets("1.3 - Breaker Settings").Cells(lastrow2, 2).Value = pwbProject.Sheets("1.2 - TCC Coordination").Cells(i, j + 1).Value
                pwbProject.Sheets("1.3 - Breaker Settings").Cells(lastrow2, 3).Value = pwbProject.Sheets("1.2 - TCC Coordination").Cells(i, j + 2).Value & " = " & pwbProject.Sheets("1.2 - TCC Coordination").Cells(i, j + 3).Value
                pwbProject.Sheets("1.3 - Breaker Settings").Cells(lastrow2, 4).Value = pwbProject.Sheets("1.2 - TCC Coordination").Cells(i, j + 2).Value & " = " & pwbProject.Sheets("1.2 - TCC Coordination").Cells(i, j + 4).Value
                lastrow2 = lastrow2 + 1
            End If
        Next j
    End If
Next i
 
Tried running some code on your pictures to see if my code worked but I can't get it to work.
And I don't want to post code that might not work as intended.
Sorry about that.
 
jhon23
As a new member, You should reread Forum Rules
 
Back
Top