Reputation: 63
I have the following basic formula,
=LEFT(A1,FIND(".",A1)-1)
How can I make this into a macro, so on my selected cell it pastes this formula? Just instead of copying and pasting over and over it may be easier to make this a shortcut to a macro. Also is this something that can be applied among-st any formulas?
Thanks
Upvotes: 0
Views: 135
Reputation: 78
You can also create custom function:
Function MyLeft(my_Cell_String) As String
MyLeft = Left(my_Cell_String, InStr(1, my_Cell_String, ".") - 1)
End Function
Then your formula in the cell will be:
=MyLeft(A1)
Upvotes: 2
Reputation: 96753
Sub qwerty()
ActiveCell.Formula = "=LEFT(A1,FIND(""."",A1)-1)"
End Sub
NOTE:
We double-up on the double-quotes!
Upvotes: 2