In Dashboard_1, you have marked the code for Closed and Open in green (commented it). This will prevent the code from running. Any specific reason why you have done so?
Cheers,
Arlette
If I helped, Don't forget to add to my reputation (click on the star below the post)
Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
Use code tags when posting your VBA code: [code] Your code here [/code]
Hello Arlette,
I commented that to see what all are executing in 3 sheets, only Open sheet is populating the data. Even if I execute the entire program its only populating data in Open sheet.
Regards,
Humac
The date format that you gave me in the dummy file was dd-mmm but in this file, its with a timestamp as well. So i just had to change a few things and got it working. Use this code -Option Explicit Dim userdate As Date Dim lrow As Long Dim i As Long Dim lastrow As Long Sub copy_data() Application.ScreenUpdating = False userdate = InputBox("Please enter the date in format mm/dd/yy", "Enter Date") With Worksheets("Sheet1") If Not Evaluate("ISREF('Received'!A1)") Then Worksheets.Add(After:=Worksheets(Worksheets.Count)).Name = "Received" .Rows("1:1").Copy Worksheets("Received").Range("A1") Else lastrow = Worksheets("Received").Range("A" & Rows.Count).End(xlUp).Row Worksheets("Received").Range("A2:U" & lastrow).ClearContents .Rows("1:1").Copy Worksheets("Received").Range("A1") End If lrow = .Range("A" & Rows.Count).End(xlUp).Row For i = 2 To lrow If .Range("L" & i).Value Like userdate & "*" Then If .Range("S" & i).Value = "Team A" Or .Range("S" & i).Value = "Team B" Or .Range("S" & i).Value = "Team C" Or _ .Range("S" & i).Value = "Team D" Or .Range("S" & i).Value = "Team E" Then .Range("A" & i & ":U" & i).Copy Worksheets("Received").Range("A" & Rows.Count).End(xlUp).Offset(1, 0) End If End If Next i Worksheets("Received").Cells.EntireColumn.AutoFit If Not Evaluate("ISREF('Closed'!A1)") Then Worksheets.Add(After:=Worksheets(Worksheets.Count)).Name = "Closed" .Rows("1:1").Copy Worksheets("Closed").Range("A1") Else lastrow = Worksheets("Closed").Range("A" & Rows.Count).End(xlUp).Row Worksheets("Closed").Range("A2:U" & lastrow).ClearContents .Rows("1:1").Copy Worksheets("Received").Range("A1") End If For i = 2 To lrow If .Range("N" & i).Value Like userdate & "*" Then If .Range("S" & i).Value = "Team A" Or .Range("S" & i).Value = "Team B" Or .Range("S" & i).Value = "Team C" Or _ .Range("S" & i).Value = "Team D" Or .Range("S" & i).Value = "Team E" Then If .Range("U" & i).Value = "Closed" Or .Range("U" & i).Value = "Closure Pending" Or .Range("U" & i).Value = "Verified closed" Then .Range("A" & i & ":U" & i).Copy Worksheets("Closed").Range("A" & Rows.Count).End(xlUp).Offset(1, 0) End If End If End If Next i Worksheets("Closed").Cells.EntireColumn.AutoFit If Not Evaluate("ISREF('Open'!A1)") Then Worksheets.Add(After:=Worksheets(Worksheets.Count)).Name = "Open" .Rows("1:1").Copy Worksheets("Open").Range("A1") Else lastrow = Worksheets("Open").Range("A" & Rows.Count).End(xlUp).Row Worksheets("Open").Range("A2:U" & lastrow).ClearContents .Rows("1:1").Copy Worksheets("Received").Range("A1") End If For i = 2 To lrow If .Range("S" & i).Value = "Team A" Or .Range("S" & i).Value = "Team B" Or .Range("S" & i).Value = "Team C" Or _ .Range("S" & i).Value = "Team D" Or .Range("S" & i).Value = "Team E" Then If .Range("U" & i).Value = "New" Or .Range("U" & i).Value = "Open" Or .Range("U" & i).Value = "Pending" Then .Range("A" & i & ":U" & i).Copy Worksheets("Open").Range("A" & Rows.Count).End(xlUp).Offset(1, 0) End If End If Next i Worksheets("Open").Cells.EntireColumn.AutoFit End With Application.ScreenUpdating = True End Sub
Cheers,
Arlette
If I helped, Don't forget to add to my reputation (click on the star below the post)
Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
Use code tags when posting your VBA code: [code] Your code here [/code]
Thanks a LOT & I appriciate your help!! Its working gr8.
I got the point now, it populated data in Open sheet because it does not need date to validate the data.
Yes exactly. Next time ensure that you give the data in the same format as your original file, it works faster.
Cheers,
Arlette
If I helped, Don't forget to add to my reputation (click on the star below the post)
Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
Use code tags when posting your VBA code: [code] Your code here [/code]
Sorry about that. Actually I have added the same way in the sample sheet, but due to my excel format it has been changed to dd-mmm. I make sure to double check it from now onwards.
hi all,
i also have some problems when i want to copy data from other files.
I want to use Command button to open folder, which contains .csv files. When i'll choose one of the files the aplication should put all the data from the file to an excel sheet 1.
could you pls help me with this?
Karo,
Welcome to Forum!!!
As per the forum rules No. 2 you should not hijack others thread. Please submit a new thread and some one will get back to you.
Forum Rule 2: Don't post a question in the thread of another member -- start your own. If you feel it's particularly relevant, provide a link to the other thread.
Regards,
Humac
sorry, i'm new here, it wont happen again
karo![]()
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks