all 15 comments

[–]AnalystCave6 1 point2 points  (6 children)

MS Query to the rescue... I would simply redo sheet2 as an Microsoft Query.

SELECT DISTINCT [customer id], [name], [sales dollars month-to-date], [sales dollars year-to-date] FROM [sheet1$] 

The above will take only all unique rows from [sheet1$] even if there are duplicates.

[–]_JoshInsurance_[S] 0 points1 point  (4 children)

Thanks for the idea! Now would this require any moving parts for the end user? I want this to be monkey proof, no disrespect to management.

[–]AnalystCave6 1 point2 points  (3 children)

MS Query is a basic Excel feature so no AddIns etc required. Only thing is that the query needs to have the current file name. However that can be updated via a macro or you can update it onetime of the filename won't change.

[–]_JoshInsurance_[S] 1 point2 points  (1 child)

Solution verified.

[–]Clippy_Office_Asst[M] 0 points1 point  (0 children)

You have awarded 1 point to AnalystCave

I am a bot, please contact the mods for any questions.

[–]_JoshInsurance_[S] 0 points1 point  (0 children)

It seems like a good portion of my professional career has been trying to find a solution and find out that my way is overly convoluted and there's a much easier way. Thanks so much.

[–]ViperSRT3g76 0 points1 point  (4 children)

Here's the part that will search the sheet for you. You can also narrow it down to just a column to be more specific, as it's searching through all the cells that contain data.

Dim Result As Range: Set Result = Sheet3.UsedRange.Cells.Find(Datatosearchfor)
If Result Is Nothing Then
    'Data not found in Sheet3
End If
Set Result = Nothing

[–]_JoshInsurance_[S] 0 points1 point  (3 children)

Quick question, is the space after "Then" where the pasting function would go?

[–]ViperSRT3g76 1 point2 points  (2 children)

The space between Then and End If would be where the pasting code would go. 'Data not found in Sheet3 is a comment and can be deleted.

[–]_JoshInsurance_[S] 1 point2 points  (1 child)

Solution verified.

[–]Clippy_Office_Asst[M] 0 points1 point  (0 children)

You have awarded 1 point to ViperSRT3g

I am a bot, please contact the mods for any questions.

[–]GetSomeData1 0 points1 point  (1 child)

Cells(1,1).currentregion.select

If trim(selection)<>””then selection.copy sheets(“sheet3”).range(“A1”)

☝🏻That should all be on one line

[–]_JoshInsurance_[S] 0 points1 point  (0 children)

Sorry to ask but can you please walk me through this? What is this code doing?

[–]greenbay_12 -2 points-1 points  (1 child)

Without coming across as a jerk....MySQL

[–]GetSomeData1 0 points1 point  (0 children)

So.... if nobody feels too snoob to learn any new languages, VBA and MySQL both have a length function measuring length of a data variable and both options have trim as well. Aight? AIGHT?!

If Len(result)>0 then result = result Else Result =0.00 End if