ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel VBA MID Function (https://www.excelbanter.com/excel-programming/291911-re-excel-vba-mid-function.html)

Otto Moehrbach[_6_]

Excel VBA MID Function
 
Michael
This little macro will do what you want. HTH Otto
Sub Get5678()
Dim i As Range
For Each i In Range("A1:A4")
MsgBox "Cell: " & i.Address(0, 0) & Chr(13) & _
"Characters a " & Mid(i, 5, 4)
Next i
End Sub
"Michael E." wrote in message
...
Hi,

I do have strings of characters in a column of cells. Each cell has exact

the same number of characters (11). Like this:

Cells from A1 to A4

tva/1,23/bn
bnc/2,24/vb
gzc/3,12/jb
hzf/1,56/hj

I only need the characters at position 5,6,7,8:

1,23
2,24
3,12
1,56

I would like to do the task with a vba-macro that selects cells A1-A4 and

then shows only the 4 charakters. I think the vba MID-Function Mid (string,
start, length) would be the right tool. But I donīt know how to write the
makro.

Can anyone help?
Thanks a lot

Michael





All times are GMT +1. The time now is 11:53 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com