Please Subscribe our Youtube Channel For more Videos
Friday, 29 December 2017
Monday, 5 October 2015
Extract text Based on Font Color from a Cell in Excel
'VBA: Extract text based on font color
Function GetColorText(rng As Range) As String
Dim x As String
Dim y As String
Dim i As Long
y = rng.Text
For i = 1 To VBA.Len(y)
If rng.Characters(i, 1).Font.Color = vbRed Then
x = x & VBA.Mid(y, i, 1)
End If
Next
GetColorText = x
End Function
Type this Formula =GetColorText(A1) (A1 indicates the cell you want to extract text from), press Enter key to get the needed text, then drag autofill handle to fill the formula to the range you want.
Now you can see all red text are extracted.
Function GetColorText(rng As Range) As String
Dim x As String
Dim y As String
Dim i As Long
y = rng.Text
For i = 1 To VBA.Len(y)
If rng.Characters(i, 1).Font.Color = vbRed Then
x = x & VBA.Mid(y, i, 1)
End If
Next
GetColorText = x
End Function
Type this Formula =GetColorText(A1) (A1 indicates the cell you want to extract text from), press Enter key to get the needed text, then drag autofill handle to fill the formula to the range you want.
Now you can see all red text are extracted.
Tuesday, 29 September 2015
Excel VBA Macro To Change Border Line Styles
Excel VBA Macro To Change Border Styles
Sub Borders()
Sheets.Add
'Borders
Range("B5:e15").Borders.LineStyle = xlContinuous
Range("B5:e15").Borders.LineStyle = xlDot
Range("B5:e15").Borders.LineStyle = xlThick
Range("B5:e15").Borders.LineStyle = xlSingle
Range("B5:e15").Borders.LineStyle = xlDouble
Range("B5:e15").Borders.LineStyle = xlNone
End Sub
Friday, 25 September 2015
EXCEL Macro(VBA) Code to Sort the Data
EXCEL Macro(VBA) Code to Sort the Data Based on One Particular Column
First Enter the large data in Excel sheet then Execute this Macro
Sub Sorting()
Dim X As Integer
X = InputBox("Enter The SortBase Column:")
Columns(X).Select
ActiveWorkbook.ActiveSheet.Sort.SortFields.Clear
ActiveWorkbook.ActiveSheet.Sort.SortFields.Add Key:=Cells(1, X), _
SortOn:=xlSortOnValues,
Order:=xlAscending,
DataOption:=xlSortNormal
With ActiveWorkbook.ActiveSheet.Sort
.SetRange Range("A1:H300")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
First Enter the large data in Excel sheet then Execute this Macro
Sub Sorting()
Dim X As Integer
X = InputBox("Enter The SortBase Column:")
Columns(X).Select
ActiveWorkbook.ActiveSheet.Sort.SortFields.Clear
ActiveWorkbook.ActiveSheet.Sort.SortFields.Add Key:=Cells(1, X), _
SortOn:=xlSortOnValues,
Order:=xlAscending,
DataOption:=xlSortNormal
With ActiveWorkbook.ActiveSheet.Sort
.SetRange Range("A1:H300")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
Thursday, 10 September 2015
Monday, 29 June 2015
Get Day Name From Date
TEXT(B4,"ddd"):
If you need to get the day name (i.e. Monday, Tuesday, etc.) from a date, there are several options depending on your needs.
Do you just want to display the day name?
"ddd" // "Wed" "dddd" // "Wednesday"
Excel will display only the day name, but it will leave the date value intact.
Do you want to convert the date into a day name?
If you want to convert the date value to a text value, you can use the TEXT function with a custom number format like "ddd". The formula looks like this:
=TEXT(B4,"DDD")
The TEXT function converts values to text using the number format that you provide. Note that date is lost in the conversion, only the text for the day name remains.
Subscribe to:
Posts (Atom)