Can someone send me simple code to connect to Azure SQL from Excel for Mac 2016 and run a query and return data to Excel, without involving the purchase of a third party software? Seems that should be doable. To add a line break taking into account the current OS (Mac or Windows), you can use the INFO function to test the system and then return the correct break character — CHAR(10) for Windows, CHAR(13) for Mac. How this formula works The character used. The Excel CHAR function returns a character when given a valid character code.
Sub RemoveLineBreaks Application.ScreenUpdating = False Dim rngCel As Range Dim strOldVal As String Dim strNewVal As String For Each rngCel In Selection If rngCel.HasFormula = False Then strOldVal = rngCel.Value strNewVal = strOldVal Debug.Print rngCel.Address Do strNewVal = Replace(strNewVal, vbLf, ' ') If strNewVal = strOldVal Then Exit Do strOldVal = strNewVal Loop If rngCel.Value strNewVal Then rngCel = strNewVal End If End If rngCel.Value = Application.Trim(rngCel.Value) Next rngCel Application.ScreenUpdating = True End Sub.