Copy row when a certain value is on Sheet1 to Sheet2

Key M

New Member
Joined
Dec 18, 2018
Messages
3
Hi
I am new to VBA. and need a lots of help to make it work.

The first Sheet (Everything) got everything, and when i put a value under department like Miami then i want to copy the entire row to my Sheet called Miami.
And so on. I have googled it and watched some youtube, but i cant figure out what to do.

ComputernameUsernameComputerDepartmentSerialnumberInstalled
PC01AdminLatitude E7450Miami11111112017-09-25
PC02SellSurface 3New York22222222017-05-01
PC03EconLatitude E7450Seattle33333332013-09-11
PC04Seller2Surface 3New York44444442017-05-01

<tbody>
</tbody>
 

UncleCatwoman

New Member
Joined
Nov 3, 2016
Messages
35
It looks like you're tracking inventory. Is there a reason you can't just leave it all one one tab and filter for a single department/location when you need to?
 

Key M

New Member
Joined
Dec 18, 2018
Messages
3
It looks like you're tracking inventory. Is there a reason you can't just leave it all one one tab and filter for a single department/location when you need to?
Thanks for anwer.
Its to keep it cleaner and easier for end-users, and they also wanted to have this function for other projects.
Im just an IT-Admin so i promised to much and told them that i will probably solve it :eek:
 

UncleCatwoman

New Member
Joined
Nov 3, 2016
Messages
35
You still don't want to have to worry about maintaining data in multiple worksheets.

What I would do (and have done) is write a macro that filters your main sheet for each department/location and then saves them as individual files. That way, after making updates, you just run the macro. And everyone knows where to go to get the most current copy of each.
 

Key M

New Member
Joined
Dec 18, 2018
Messages
3
I found something pretty close to what im searching for.

How can i Make this Macro to "Auto-Run" as soon as a new row is typed?

Option Explicit


Sub Test()


Dim Cell As Range


With Sheets(1)
' loop column D untill last cell with value (not entire column)
For Each Cell In .Range("D2:D" & .Cells(.Rows.Count, "D").End(xlUp).Row)
If Cell.Value = "Miami" Then
' Copy>>Paste in 1-line (no need to use Select)
.Rows(Cell.Row).Copy Destination:=Sheets(2).Rows(Cell.Row)
End If
Next Cell
End With


End Sub
 

Forum statistics

Threads
1,081,561
Messages
5,359,611
Members
400,539
Latest member
JimUSMC

Some videos you may like

This Week's Hot Topics

  • VBA (Userform)
    Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
  • List box that changes fill color
    Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
  • Remove duplicates and retain one. Cross-linked cases
    Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
  • VBA Copy and Paste With Duplicates
    Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
  • Macro
    is it possible for a macro to run if the active cell value is different to the value above it
  • IF DATE and TIME
    I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...
Top