record macro text go missing when run

M

mango

hi all,
i record a macro. when function data, i wll paste special as value for
number and text.

for example,
Branch Customer Company Date
2311 0091 xyz 15102004

as i need to reserve the company size to 20 so for those less than 20, i
have a if statement to reserve the balance. i do a paste special to other
cell as value. the same goes to date. the function as =TEXT(NOW(),"ddmmyyyy")
so i paste special as value.

after this i do a concatenate of these cells and paste special.

above all record in macro. all just fine. i manual process without macro
also fine.

when actual run the macro the result like this. company missing.
2311009115102004

pls help.
 
M

mango

dear frank, hope u can help. thanks alot


Sub MHeader1()
'
' MHeader1 Macro
' Macro recorded 15/10/2004 by
'

'
ActiveCell.FormulaR1C1 = _
"=IF(LEN(R[-2]C)<20,R[-2]C&REPT(""
"",20-LEN(R[-2]C)),LEFT(R[-2]C,20))"
Range("D4").Select
Selection.Copy
Range("D6").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("E2").Select
Application.CutCopyMode = False
Selection.Copy
Range("E6").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("L2").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = _
"=CONCATENATE(RC[-11],RC[-10],RC[-9],R[4]C[-8],R[4]C[-7])"
Range("L2").Select
Selection.Copy
Range("M2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Selection.Copy
Sheets("Final").Select
Range("A1").Select
ActiveSheet.Paste
Sheets("Header").Select
ActiveWindow.LargeScroll ToRight:=-1
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 6
ActiveWindow.ScrollColumn = 7
ActiveWindow.ScrollColumn = 8
Range("M2").Select
Application.CutCopyMode = False
Selection.ClearContents
Range("L2").Select
Selection.ClearContents
ActiveWindow.SmallScroll ToRight:=-7
Range("E6").Select
Selection.ClearContents
Range("D6").Select
Selection.ClearContents
Range("D4").Select
Selection.ClearContents
Range("D2").Select
Selection.ClearContents
End Sub
 
M

mango

dear frank, instead of putting in the same column i put in next column for
those need to paste special.
thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top