EXCEL macro : String manipulation (EXACT,CONCATENATE,ISBLANK,ISNUMBER)

In this post, I will explain more on string manipulation (EXACT,CONCATENATE,ISBLANK,ISNUMBER).
The function on the worksheet and vba code are a bit different, so you need to pay attention on this.

EXACT              -> Checks to see if two text values are identical (case sensitive)
CONCATENATE  -> Joins several text items into one text item
ISBLANK           -> Refers to an Empty Cell, Function returns True or False
ISNUMBER         -> Refers to a Cell, Function returns True or False.



Below, I'll show on how to use EXACT,CONCATENATE,ISBLANK,ISNUMBER in both
worksheet function and vba code.


Worksheet function









Vba code
=====================================================

 Sub str()  
 Dim a, b, c, d, e, f, g, h, i As String  
 a = Sheet1.Cells(2, 1).Value 'Saya  
 b = Sheet1.Cells(2, 2).Value 'suka  
 c = Sheet1.Cells(2, 3).Value 'makan  
 d = Sheet1.Cells(2, 4).Value 'nasi  
 e = Sheet1.Cells(2, 5).Value 'Saya  
 f = Sheet1.Cells(3, 1).Value '1  
 g = Sheet1.Cells(3, 2).Value '2  
 h = Sheet1.Cells(3, 3).Value '3  
 i = Sheet1.Cells(3, 4).Value '4  
 j = Sheet1.Cells(4, 1).Value  
 'conjugate  
 Sheet1.Cells(19, 1).Value = a & b & c & d & f & g & h & i  
 Sheet1.Cells(20, 1).Value = a & " " & b & " " & c & " " _  
 & " " & d & " " & f & g & h & i  
 'isempty  
 Sheet1.Cells(21, 1).Value = IsEmpty(c)  
 Sheet1.Cells(22, 1).Value = IsEmpty(j)  
 'exact  
 Sheet1.Cells(23, 1).Value = a = b  
 Sheet1.Cells(24, 1).Value = a = e  
 'isnumberic  
 Sheet1.Cells(25, 1).Value = IsNumeric(a)  
 Sheet1.Cells(26, 1).Value = IsNumeric(f)  
 End Sub  
 Sub delete()  
 Dim i As Integer  
 For i = 19 To 26  
 Sheet1.Cells(i, 1).Value = " "  
 Next i  
 End Sub  
=====================================================

Download example

No comments:

Post a Comment