Vonsteiner
New Member
- Joined
- Apr 14, 2014
- Messages
- 45
- Office Version
- 365
- Platform
- Windows
Hello everyone,
I am having some trouble using a UDF in my VBA code. I am attempting to enter a UDF into a cell within my workbook. Hopefully it is an easy fix. I am not sure if I have entered it into VBA correctly. Here are some snippets of the code I am trying. In the following I am entering some formulas in D and E and attempting to enter the UDFs 'Direction' and 'Street_Name' into F & G. The formulas in D & E work fine, but the UDF lines don't enter anything into the worksheet at all.
I have more code to show if needed, but it is mostly the same as this. Any help is greatly appreciated. Thank you.
I am having some trouble using a UDF in my VBA code. I am attempting to enter a UDF into a cell within my workbook. Hopefully it is an easy fix. I am not sure if I have entered it into VBA correctly. Here are some snippets of the code I am trying. In the following I am entering some formulas in D and E and attempting to enter the UDFs 'Direction' and 'Street_Name' into F & G. The formulas in D & E work fine, but the UDF lines don't enter anything into the worksheet at all.
VBA Code:
Range("D2").Select
ActiveCell.FormulaR1C1 = "=TRIM(LEFT(RC[-2],FIND("":"",RC[-2])-1))"
Range("D2").Select
Selection.Copy
Range(Selection, Selection.End(xlDown)).Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("B2").Select
Selection.End(xlDown).Select
Selection.Offset(0, 3).Select
ActiveCell.FormulaR1C1 = "=TRIM(LEFT(RC[-1],FIND("" "",RC[-1])-1))"
Selection.Copy
Range(Selection, Selection.End(xlUp)).Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("E1").Value = "House Number"
Range("F2").Select
Selection.FormulaArray = "=Direction(RC[-2])"
Selection.Copy
Range("F3").Select
Range(Selection, Selection.End(xlDown)).Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("G2").Select
Selection.FormulaArray = "=Street_Name(RC[-3])"
Selection.Copy
Range("G3").Select
Range(Selection, Selection.End(xlDown)).Select
ActiveSheet.Paste
Application.CutCopyMode = False
I have more code to show if needed, but it is mostly the same as this. Any help is greatly appreciated. Thank you.