![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Posts: 97
|
How can I make sure that a cell is empty. I am concatenating several cell separated by "|" symbol and when a cell is emppty the concatenation should be || but sometimes I get | |, I don't know why because the cell looks empty.
I want to avoid the space between the pipes if the cell is empty. Hugo |
|
|
|
|
|
#2 |
|
Guest
Posts: n/a
|
|
|
|
|
#3 |
|
New Member
Join Date: Feb 2002
Location: Bloomington, MN
Posts: 16
|
Perhaps you could just not worry about the cell being empty and remove the spaces from your concatenated string. Assuming your resulting string is in B3, the following would remove all the spaces in it. =SUBSTITUTE(B3," ",""). If the string contains spaces you want to keep and you just want to remove a single space between the two vertical line symbols, try =SUBSTITUTE(B3,"| |","||")
JayD |
|
|
|
|
|
#4 |
|
Guest
Posts: n/a
|
If activecell = "" Then
|
|
|
|
#5 |
|
Guest
Posts: n/a
|
If activecell = "" Then
'your actions else: end if |
|
|
|
#6 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: The Hague
Posts: 50,314
|
Quote:
|
|
|
|
|
|
|
#7 |
|
Board Regular
Join Date: Feb 2002
Posts: 3,064
|
Hi
How can I make sure that a cell is empty Select the cell Right click Clear contence Then do as you need - can be done in range selectionor single cell, EMPTY is not cleaned cell delete or by bush space bar or delet characters HTH Rdgs ========== Jack |
|
|
|
|
|
#8 | ||
|
Board Regular
Join Date: Feb 2002
Posts: 97
|
Quote:
I am using this code in VB acumular2 = ActiveCell.Offset(0, 0) & "|" & ActiveCell.Offset(0, 1) & "|" & ActiveCell.Offset(0, 2) & "|" & ActiveCell.Offset(0, 3) & "|" but sometimes the cell looks empty, but it isn't (it is like pressing the space bar in the cell, it looks empty because you haven't write any characters, but it is not empty because you press the space bar). Instead og getting: HI|how||you| I get HI|how| |you| I want to avoid the second one. It is a big range thaat is why I can't check cell by cell and deleted manually. Hugo |
||
|
|
|
|
|
#9 | |||
|
MrExcel MVP
Join Date: Feb 2002
Location: The Hague
Posts: 50,314
|
Quote:
I don't know VBA. However, I'd suggest adding the TRIM function (if exists, the VBA equivalent of it), before you concat the contents of a cell to that of another. In the world of formulas, that would look something like: =TRIM(A1)&"|"&TRIM(B1)&"|"&TRIM(C1) Aladin |
|||
|
|
|
|
|
#10 | ||||
|
Board Regular
Join Date: Feb 2002
Posts: 97
|
Quote:
Thanks, Hugo |
||||
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|