Convert text to number and fill formulae down

Mr2017

Well-known Member
Joined
Nov 28, 2016
Messages
644
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi

I've got two quick questions for which your help would be appreciated, if you've experienced this before:

i) I recorded a macro which selects data in a column and converts it to numbers (from text).
Each cell had the green triangle in the top right hand side saying 'Number stored as text'). However, although the text was converted to numbers, the macro doesn't work if it's re-run. Does anyone know why? It seems as though the record option didn't record what happened when the 'convert to number' action was done? The code is below.

Code:
Sub convert_text()


    Range("C5").Select
    Range(Selection, Selection.End(xlDown)).Select


End Sub

ii) I've recorded a separate macro which also has the text conversion at the beginning (which isnt working) but then uses an index match to get a friendly name for some data. However, I'd like to amend the part of the code that fills the formula to fill it down to the end of the range (this is the part of the code below that I'm talking about

Selection.AutoFill Destination:=Range("E5:E168")
Range("E5:E168").Select

At present, it only goes far as row 168


Sub get_name()


Range("C5").Select
Range(Selection, Selection.End(xlDown)).Select
Sheet4.Select
Sheet10.Visible = True
Sheet4.Select
Range("E5").Select
ActiveCell.FormulaR1C1 = _
"=INDEX('Nominations Data'!C[2],MATCH('Review Tab'!RC[-2],'Nominations Data'!C,0))"
Range("E5").Select
Selection.AutoFill Destination:=Range("E5:E168")
Range("E5:E168").Select
Columns("F:G").Select
Selection.Delete Shift:=xlToLeft

End Sub
Code:
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
How about
Code:
   With Range("C5", Range("C" & Rows.Count).End(xlUp))
      .NumberFormat = "0"
      .Value = .Value
   End With
   With Sheet4
      With .Range("E5", .Range("C" & Rows.Count).End(xlUp).Offset(, 2))
         .FormulaR1C1 = "=INDEX('Nominations Data'!C[2],MATCH('Review Tab'!RC[-2],'Nominations Data'!C,0))"
      End With
   End With
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,214,823
Messages
6,121,777
Members
449,049
Latest member
greyangel23

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