Jeffrey Vogelzang
asked on
Automatically fill columns with formula with conditions
I have columns in an Excel sheet that I would like to automatically fill with a formula.
The VBA code I currently have is:
Range("M3") = "=J3&"" & ""&K3": Range("M3:M" & lRow).FillDown
However, column K contains the spouse's name if they have one, which means sometimes the cell in column K is blank. If the person doesn't have a spouse, column M then reads:
First Name (from column J) &.
I've tried the following code but it causes an error:
Range("M3") = IF(Len(K3)=),"=J3&","=J3&" " & ""&K3": Range("M3:M" & lRow).FillDown
Any suggestions?
Thanks in advance.
The VBA code I currently have is:
Range("M3") = "=J3&"" & ""&K3": Range("M3:M" & lRow).FillDown
However, column K contains the spouse's name if they have one, which means sometimes the cell in column K is blank. If the person doesn't have a spouse, column M then reads:
First Name (from column J) &.
I've tried the following code but it causes an error:
Range("M3") = IF(Len(K3)=),"=J3&","=J3&"
Any suggestions?
Thanks in advance.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You're welcome Jeffrey! Glad I could help.
ASKER