ststern45
Well-known Member
- Joined
- Sep 17, 2005
- Messages
- 965
- Office Version
- 365
- 2010
- Platform
- Windows
Hello,
I have a range of cell from A1 through F1
Values in this range can vary from 00 through 99
Cell G1 contains the formula that concatenates all the values from range A1 through F1
Random cells in A1 through F1 may be empty.
Each of the values will be separated by a coma.
I found the following code for a Functions that works but I'm looking for code that will keep the 1st zero when concatenating the range
If a cell contains any value for 00 though 09 I would like to keep the 1st zero.
Function ConcatenateButBlank(selectArea As Range) As String
For Each oneCell In selectArea: finalResult = IIf(oneCell = "", finalResult & "", finalResult & oneCell & ","): Next
ConcatenateButBlank = Left(finalResult, Len(finalResult) - 1)
End Function
Thank you in advance!!
I have a range of cell from A1 through F1
Values in this range can vary from 00 through 99
Cell G1 contains the formula that concatenates all the values from range A1 through F1
Random cells in A1 through F1 may be empty.
Each of the values will be separated by a coma.
I found the following code for a Functions that works but I'm looking for code that will keep the 1st zero when concatenating the range
If a cell contains any value for 00 though 09 I would like to keep the 1st zero.
Function ConcatenateButBlank(selectArea As Range) As String
For Each oneCell In selectArea: finalResult = IIf(oneCell = "", finalResult & "", finalResult & oneCell & ","): Next
ConcatenateButBlank = Left(finalResult, Len(finalResult) - 1)
End Function
Thank you in advance!!