Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi Per, Once again thanks a lot for your help, this works perfecto!!
Cheers, Chappy "Per Jessen" wrote: Hi Chappy Thanks for your reply, I'm glad that you could use my UDF. Here are two (three) ways to fill in the formula. The second macro is the simplest, but it requieres that you enter the formula in AO2 before the macro is ran. The first macro fill in the formula, you just have to change TargetCol to the column holding your phone numbers. Sub FillInFormula() Dim StartRow As Long Dim LastRow As Long Dim FormulaCol As String Dim TargetCol As String StartRow = 2 LastRow = Range("A1").End(xlDown).Row FormulaCol = "AO" TargetCol = "AN" 'Change to phone num col 'Columns(FormulaCol).NumberFormat = "@" ' This line is needed if you choose option # 2 below For r = StartRow To LastRow Range(FormulaCol & r).Formula = "=ExtractNum(" & TargetCol & r & ")" ' Option # 1 'Range(FormulaCol & r) = ExtractNum(Range(TargetCol & r))' Option # 2 Next End Sub Sub FillInForm() ' Requires the formula in A02 before this macro is started LastRow = Range("A1").End(xlDown).Row Range("AO2").Copy Range("AO2:AO" & LastRow) End Sub Best regards, Per "Chappy" skrev i meddelelsen ... Hi Per, Just one other query that you may be able to help with in relation to this. My data comes in with a variable number of rows each day. Is there a way to fill the relevant column down until it reaches the last line of data each time? In Column A there is always a value, so this will always indicate the number of rows of data in the file. Column AO contains the phone number formula, beginning at AO2, that you posted. Is it possible to fill Column AO down to the last row as indicated by column A? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Microsoft Visual Basic errors displaid when opening Microsoft Word 97 & Excel (7 | Setting up and Configuration of Excel | |||
Excel Throwing Circular Errors When No Errors Exist | Excel Worksheet Functions | |||
Print errors with Word documents in Excel spreadsheets | Excel Discussion (Misc queries) | |||
passing arguments from an excel macro to a word macro | Excel Discussion (Misc queries) | |||
Macro - Open Word with Excel macro | Excel Discussion (Misc queries) |