Posts by dangle
-
-
Re: Cut part of a Cell to another cell
Hi Jar801
Try substituting this code into yours:
Code
Display MoreSub ListFoldersAndInfo(foldername As String, Destination As Range) Dim FSO As Object Dim Folder As Object Dim R As Long Dim SubFolder As Object Dim Wks As Worksheet Dim str As String Set FSO = CreateObject("Scripting.FileSystemObject") Set Folder = FSO.GetFolder(foldername) Destination = Folder.Name str = Destination.Value If str Like "Video*" Then On Error Resume Next Destination = Left(str, InStr(1, str, " ") - 1) Destination.Offset(0, 1) = Mid(str, InStr(str, "(") + 1, 4) End If Destination.Offset(0, 2) = Folder.Size Set Destination = Destination.Offset(1, 0) For Each SubFolder In Folder.SubFolders ListFoldersAndInfo Folder.Path & "\" & SubFolder.Name, Destination Next SubFolder Set FSO = Nothing End Sub
-
Re: Copy Rows Based on Criteria
Does it have to be a macro?
How about if you filtered and then looked for values greater than 1 in the "Short" column? -
Re: calculation that when copied across does not miss a newly inserted column.
Happy New Year!
Try entering in cell X9:
=IF(OFFSET(X3,0,1)="forecast",X6,0) -
Re: Duplicate data corresponding to data in another column
Now that IS efficient! Nice one Jindon.
-
-
Re: Find todays date and highlight the row
No probs Lynne. Glad to help.
-
Re: Duplicate data corresponding to data in another column
Vamsi
You can run the macro using the button.
There are 4 output columns:
1. The subject
2. The number of times the subject occurs in the list
3. Whether duplicate date entries exist or not for the relevant subject?
4. How many unique date entries there are for that subject?In 4, I have changed your question around slightly as I am not quite sure what you are after but perhaps you can clarify once you have had a look at the output and I can change as necessary.
If you have 1000s of lines of data then this may not be the most efficient solution.
Code
Display MoreSub FindDuplicates() Dim FilterRange As Range Dim UniqueList As Range Dim UniqueList2 As Range Dim RowCount As Long Dim LoopCell As Range Dim lCount As Long Dim wksSource As Worksheet Set wksSource = ActiveSheet Application.ScreenUpdating = False If (wksSource.AutoFilterMode) Then wksSource.AutoFilterMode = False Range("V2") = "No. of subject occurrences" Range("W2") = "Do duplicates exist?" Range("X2") = "How many unique entries?" Set FilterRange = Range("O2", Range("O2").End(xlDown)) Range(FilterRange.Address).AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range("U2" _ ), Unique:=True Set UniqueList = Range("U3", Range("U3").End(xlDown)) For Each LoopCell In UniqueList lCount = WorksheetFunction.CountIf(FilterRange, LoopCell.Value) LoopCell.Offset(0, 1).Value = lCount With Range("A2:S274") .AutoFilter Field:=15, Criteria1:=LoopCell.Value, Operator:=xlAnd .Copy Destination:=Range("Z2") End With If Range("AA4").Value = "" Then LoopCell.Offset(0, 2).Value = "NO" LoopCell.Offset(0, 3).Value = 1 Else Set UniqueList2 = Range("AA2", Range("AA2").End(xlDown)) Range(UniqueList2.Address).AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range("AB2" _ ), Unique:=True RowCount = Range("AB3", Range("AB3").End(xlDown)).Rows.Count If RowCount <> lCount Then LoopCell.Offset(0, 2).Value = "YES" LoopCell.Offset(0, 3).Value = RowCount Else LoopCell.Offset(0, 2).Value = "NO" LoopCell.Offset(0, 3).Value = lCount End If End If Columns("Z:AB").Delete Next LoopCell wksSource.AutoFilterMode = False Columns("U:X").EntireColumn.AutoFit Application.ScreenUpdating = True End Sub
-
Re: run an excel query refresh and then a macro every hour
There are some details on scheduling on another page.
http://www.ozgrid.com/Excel/run-macro-on-time.htm
Does this help?
-
Re: Find todays date and highlight the row
Lynne
Try this macro. You may need to adjust the cell start point in date range depending on how your data is set up.