Skip to main content

Hello everyone and thanks for reading me. I currently have some quick reports that are scheduled to be sended to coworker emails with an excel file (from a query). Its there a way to add VBA code to the excel attached like the following:

 

Sub Sample()
   Debug.Print Now

   Dim ws As Worksheet
   Dim wsTemp As Worksheet

   Set ws = Sheet1

   Set wsTemp = ThisWorkbook.Sheets.Add

   ws.Columns(1).Copy wsTemp.Columns(1)

   wsTemp.Columns(1).RemoveDuplicates Columns:=1, Header:=xlNo

   If Application.WorksheetFunction.CountA(ws.Columns(1)) <> _
      Application.WorksheetFunction.CountA(wsTemp.Columns(1)) Then
       Debug.Print "There are duplicates in Col A"
   Else
       Debug.Print "duplicates found in Col A"
   End If

   Application.DisplayAlerts = False
   wsTemp.Delete
   Application.DisplayAlerts = True

   Debug.Print Now
End Sub

 

The main purpose its to automatically mark duplicated values in the excel report

Thanks for your help!

Hi Jorge

I don’t think that’s possible, but maybe I’m wrong. I would think that the Excel file used to export the results is a standard blank Excel Worksheet likely not configurable. I don’t think you can add custom code or macros or anything on that front.

 

Having said that, I don’t know if you are aware, but there is a weekly “IFS Customer Drop-In Session”. You can talk to IFS there (depending on who is there to represent IFS) and voice your concern. They may be able to confirm whether that capability exists and you could have direct access to IFS to maybe convince them to incorporate that feature (which I assume should not be overly complicated to include) in a future release.

 

Thanks!


Reply