LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #10   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 17
Default Excel Macro Errors - it just doesn't like Word

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?





 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Microsoft Visual Basic errors displaid when opening Microsoft Word 97 & Excel (7 JJ mac Setting up and Configuration of Excel 7 June 14th 07 06:54 PM
Excel Throwing Circular Errors When No Errors Exist MDW Excel Worksheet Functions 1 August 10th 06 02:15 PM
Print errors with Word documents in Excel spreadsheets mike-ss Excel Discussion (Misc queries) 0 August 10th 05 05:11 PM
passing arguments from an excel macro to a word macro KWE39 Excel Discussion (Misc queries) 1 July 7th 05 03:56 PM
Macro - Open Word with Excel macro Bill Excel Discussion (Misc queries) 3 May 23rd 05 11:21 PM


All times are GMT +1. The time now is 07:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"