yitzyy

Excel Hacks

Apr 18th, 2016
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. REMOVE Non-Alphanumeric
  2. Function removeAlpha(r As String) As String
  3. With CreateObject("vbscript.regexp")
  4.     .Pattern = "[^A-Za-z0-9]"
  5.     .Global = True
  6.     removeAlpha = .Replace(r, "-")
  7. End With
  8. End Function
  9. Credit: http://www.mrexcel.com/forum/excel-questions/498357-strip-alpha-characters-string.html#post2460424
  10.  
  11. Merge Excel files:
  12. Sub GetSheets()
  13. Path = "C:\Users\yyounger\Desktop\weintraub\"
  14. Filename = Dir(Path & "*.xlsx")
  15.   Do While Filename <> ""
  16.   Workbooks.Open Filename:=Path & Filename, ReadOnly:=True
  17.      For Each Sheet In ActiveWorkbook.Sheets
  18.      Sheet.Copy After:=ThisWorkbook.Sheets(1)
  19.   Next Sheet
  20.      Workbooks(Filename).Close
  21.      Filename = Dir()
  22.   Loop
  23. End Sub
  24. Credit: https://www.extendoffice.com/documents/excel/456-combine-multiple-workbooks.html
  25.  
  26. Convert UNIX to readable date: =CELL/(60*60*24)+"1/1/1970"
Add Comment
Please, Sign In to add comment