Rolly_Sefu
Board Regular
- Joined
- Oct 25, 2013
- Messages
- 149
Hello,
I have this code line:
"<first name>" this is part of a Range for a function to combine multiple cells into 1 cell info
When i edit something in the sheet, the function performs correctly.
But once the macro runs past the replace line function returns "#Value!" since the range is Nothing.
How can i fix this ?
Thank you.
I have this code line:
VBA Code:
Sheets("Mail").Range("B8:B100").Replace What:="<first name>", Replacement:=cell.Value, SearchOrder:=xlByColumns, MatchCase:=True
"<first name>" this is part of a Range for a function to combine multiple cells into 1 cell info
Code:
Function Combine(WorkRng As Range) As String
'combine entire range into one cell
'=Combine(A1:E1)
Dim Rng As Range
Dim OutStr As String
For Each Rng In WorkRng
OutStr = OutStr & Rng.Text & Chr(13) + Chr(10)
Next
Combine = OutStr
End Function
When i edit something in the sheet, the function performs correctly.
But once the macro runs past the replace line function returns "#Value!" since the range is Nothing.
How can i fix this ?
Thank you.