ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help with Code (https://www.excelbanter.com/excel-programming/359561-help-code.html)

JimMay

Help with Code
 
After Running the below Macro, certain cells (just 2 or 3) contain The
R[-1]C versus 65546 (a number type); How can I correct?
TIA;;


Private Sub FillNum()
' Macro recorded 4/23/2006 by Jim May
'
Lrow = Cells(Rows.Count, "E").End(xlUp).Row ' get last row using
amt col
Set MyNum = Range("F5:F" & Lrow)
MyNum.SpecialCells(xlCellTypeBlanks).Select
Selection.FormulaR1C1 = "=R[-1]C"
MyNum.Copy
MyNum.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("A4").Select
End Sub


Bob Phillips[_6_]

Help with Code
 
Are those cells formatted as Text?

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"JimMay" wrote in message
news:EcT2g.7644$fG3.5368@dukeread09...
After Running the below Macro, certain cells (just 2 or 3) contain The
R[-1]C versus 65546 (a number type); How can I correct?
TIA;;


Private Sub FillNum()
' Macro recorded 4/23/2006 by Jim May
'
Lrow = Cells(Rows.Count, "E").End(xlUp).Row ' get last row using
amt col
Set MyNum = Range("F5:F" & Lrow)
MyNum.SpecialCells(xlCellTypeBlanks).Select
Selection.FormulaR1C1 = "=R[-1]C"
MyNum.Copy
MyNum.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("A4").Select
End Sub




Tom Ogilvy

Help with Code
 
I wouldn't expect a problem with it but try

MyNum.Formula = MyNum.Value

rather than

MyNum.Copy
MyNum.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False

--
Regards,
Tom Ogilvy


"JimMay" wrote in message
news:EcT2g.7644$fG3.5368@dukeread09...
After Running the below Macro, certain cells (just 2 or 3) contain The
R[-1]C versus 65546 (a number type); How can I correct?
TIA;;


Private Sub FillNum()
' Macro recorded 4/23/2006 by Jim May
'
Lrow = Cells(Rows.Count, "E").End(xlUp).Row ' get last row using
amt col
Set MyNum = Range("F5:F" & Lrow)
MyNum.SpecialCells(xlCellTypeBlanks).Select
Selection.FormulaR1C1 = "=R[-1]C"
MyNum.Copy
MyNum.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("A4").Select
End Sub




Tim Williams

Help with Code
 
Looks OK to me. Some slight improvement (avoid the copy/paste):


Sub FillNum()

Dim Lrow As Long, MyNum As Range

Lrow = Cells(Rows.Count, "E").End(xlUp).Row ' get last row using amt col
With Range("F5:F" & Lrow)
.SpecialCells(xlCellTypeBlanks).FormulaR1C1 = "=R[-1]C"
.Value = .Value
End With
Range("A4").Select


End Sub


Tim

"JimMay" wrote in message news:EcT2g.7644$fG3.5368@dukeread09...
After Running the below Macro, certain cells (just 2 or 3) contain The R[-1]C versus 65546 (a number type); How can I correct?
TIA;;


Private Sub FillNum()
' Macro recorded 4/23/2006 by Jim May
'
Lrow = Cells(Rows.Count, "E").End(xlUp).Row ' get last row using amt col
Set MyNum = Range("F5:F" & Lrow)
MyNum.SpecialCells(xlCellTypeBlanks).Select
Selection.FormulaR1C1 = "=R[-1]C"
MyNum.Copy
MyNum.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("A4").Select
End Sub




Jim May

Help with Code
 
Yes, they are primarily Check Numbers,,, 63444, 63445, but an occiation
63446, Blamk, Blank, Blank, They were originally numbers - General Format; I
I looped thru trying to assign a " ' " prefix..

"Bob Phillips" wrote:

Are those cells formatted as Text?

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"JimMay" wrote in message
news:EcT2g.7644$fG3.5368@dukeread09...
After Running the below Macro, certain cells (just 2 or 3) contain The
R[-1]C versus 65546 (a number type); How can I correct?
TIA;;


Private Sub FillNum()
' Macro recorded 4/23/2006 by Jim May
'
Lrow = Cells(Rows.Count, "E").End(xlUp).Row ' get last row using
amt col
Set MyNum = Range("F5:F" & Lrow)
MyNum.SpecialCells(xlCellTypeBlanks).Select
Selection.FormulaR1C1 = "=R[-1]C"
MyNum.Copy
MyNum.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("A4").Select
End Sub






All times are GMT +1. The time now is 01:23 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com