need formula to extract 4 digit for c1 to c3 in vb macro

shrinivasmj

Board Regular
Joined
Aug 29, 2012
Messages
140
hi'

i am trying to write a code in vb macro ,i am using below formula as

Range("C3").Select
ActiveCell.FormulaR1C1 = "=MID(R[-2]C,3,4)"
Range("C3").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("C3").Select
Application.CutCopyMode = False
Range("C3").Select

c1 8795221
c3 9522


but in my excel it shows =MID(R[-2]C,3,4)

need vb macro formula
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Hi

Do you sample data and sample expected result?

Do you have a formula that works in excel without the R1C1 conversion?

Cheers, InaCell.
 
Upvote 0
Code:
Sub MM1()
With Range("C3")
   .Formula = "=MID(C1,3,4)"
   .Value = .Value
End With
End Sub
 
Upvote 0
need to extract data from cell c1 with is ryy4552

in c3 cell the data should com y455

leveing first 2 digit take next four digit. in cell c3
 
Upvote 0
Code:
Sub MM1()
With Range("C3")
   .Formula = "=MID(C1,4,4)"
   .Value = .Value
End With
End Sub
puts 4552 in cell c3 from ryy4552 in cell C1
 
Upvote 0
hi

i have lot of files were i use macro to run it

Sub MM1()
With Range("C3")
.Formula = "=MID(C1,4,4)"
.Value = .Value
End With
End Sub
in all files its shows out put as in cell c3 =MID(C1,3,4)
 
Upvote 0
Hi

You have a real problem if
Code:
[COLOR=#333333]"=MID(C1,4,4)"[/COLOR]
shows as =MID(C1,3,4) in C3.
 
Upvote 0
It probably means the cell is formatted as text !!
 
Upvote 0

Forum statistics

Threads
1,215,560
Messages
6,125,527
Members
449,236
Latest member
Afua

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top