Hello, I have a macro which copies a row of cells from one worksheet to another depending on a value of a cell in column G. If that value is '100', then it copies it to a tab called '100', if the value is 'Other' then it copies it to the 'Other' tab. They get copied to the next available row. (However, they also leave the blank spaces there; if there is some coding to get rid of that, that would also be great, however it is not priority as of yet).
I also have a number of other tabs named after people. These individuals will fill out their own tab and then when they run the macro, it will automatically put the rows into the correct tab. The code I have works for 'Ian', however when I make one for 'James', depending on which is first, the row gets replaced instead of put on the next available row. Please see the code below and I would be extremely grateful if anyone can add some coding, possible just a simple 'Or' function after the 'If a.Range' for the 'James' sheet, which I have set as d.
Thanks in advance!
![]()
Sub Transfer() Set a = Sheets("Ian") Set b = Sheets("100") Set c = Sheets("Other") Set d = Sheets("James") Dim x Dim z x = 1 z = 2 Do Until IsEmpty(a.Range("G" & z)) If a.Range("G" & z) = "100" Then x = x + 1 b.Rows(x).Value = a.Rows(z).Value Else If a.Range("G" & z) = "Other" Then x = x + 1 c.Rows(x).Value = a.Rows(z).Value End If End If z = z + 1 Loop End Sub
Bookmarks