
08-24-2008, 07:30 PM
|
|
Registered User
|
|
Join Date: 24 Aug 2008
Location: Romania
Posts: 4
|
|
|
Running macro into sheet1 changes formulas in sheet2 :(
Hy guys, i`m a new user, and a newbie in excel. However i realised some days ago i really need to make sth in excel.
I have a workbook where i registered a macro which gets some data from a .rtf delimited file and shows it in 1st sheet.
Now, i 2nd sheet i tried to order the data, so get just the data i need from sheet1, in the order i need.
This is one of the formula i use to get a string, and then delete some part to get just what i need.
=REPLACE(FM!C27,4,200,"")
The problem is that if i enter data manually in first sheet, it works. But if i try to RUN the macro to get info from other file (all files have exactly the same format) the formulas in 2nd sheet changes, and the data is not shows as it should.
For example that formula becomes =REPLACE(FM!R27,4,200,"")
i'll post here also my macro code( i didn't wrote it, i registered a macro)
Code:
Sub ImportFieldPlayer()
'
' ImportFieldPlayer Macro
'
'
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;C:\player.rtf" _
, Destination:=Range("$A$1"))
.Name = "28. João Luís Pereira Cerqueira"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 1252
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = True
.TextFileTabDelimiter = False
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = True
.TextFileSpaceDelimiter = False
.TextFileOtherDelimiter = "|"
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
End Sub
Thanks for your help, i`m waiting for a reply
|