Excel VBA macro...help needed

Puffy2411

New Member
Joined
Feb 20, 2019
Messages
5
Hello guys, im new in this and im not that smart as you dudes....well to be short i have an issue and would really need your help......i need to sort from master table using only one criteria into other worksheet to copy rows into designated column and row...is that kind of stuff posiblle?
48c37766ee2439a1cb214ab51db5d82c
48c37766ee2439a1cb214ab51db5d82c
like you see on this pic all gender is in one table how to sort it to be like this in pic 2.......so far i tryed this VBA
Code:
Sub assautz()
    Dim c As Range
    'Dim j As Integer
    Dim Source As Worksheet
    Dim Target As Worksheet
    Dim j As Long
    ' Change worksheet designations as needed
    Set Source = ActiveWorkbook.Worksheets("Kombinirani popis")
    Set Target = ActiveWorkbook.Worksheets("Muško-Ženski Assaut")


   j = Target.Cells(Target.Rows.Count, "O").End(xlUp).Row + 1 ' Start copying to row 3 in target sheet
       For Each c In Source.Range("D3:D170")   ' Do 1000 rows
        If c = "female" Then
           Source.Rows(c.Row).Copy Target.Rows(j)
          j = j + 1


        End If
    Next c
End Sub
I would really need your ideas guys......and it would be good if i can specify what row and column where to copy..any ideas?
48c37766ee2439a1cb214ab51db5d82c.png



909e986b7ef31cdc0e21e70700e16caf.png
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Basicly guys i need help how to search for text "female" in one sheet and to copy all rows that contains word "female" into other sheet into specific coulmn..lets say O into row 3,to paste it one under other...
 
Upvote 0
Gents i find the solution how to copy specific range of column and rows into other sheet specific range of colums based on criteria...i hope someone will have a use from that.

Code:
Sub Premjestaj_Assaut()

Dim i As Long
Dim j As Long




j = 3    ' it counts from row 3'
With Sheets("Sheet1")
    For i = 2 To 170  'range of rows i want to look'
        If .Cells(i, "your desired column").Value = "assaut" Then    'your column where you entered your text value or word to be searched as criteria'
            .Range("your desired column" & i & ":your desired column" & i & "," & "your desired column" & i & ":your desired column" & i).Copy ' range of cells to be copied....just replace the words  "your desired column"  with your column letter'
            Sheets("Sheet2").Range("your desired column" & j).PasteSpecial Paste:=xlPasteValues, _    'your desired sheet and column from where you want to paste copyed rows'
            Operation:=xlNone, SkipBlanks:=False


            j = j + 1
        End If
    Next i
End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,004
Messages
6,122,659
Members
449,091
Latest member
peppernaut

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top