Hello ,
Here are two ways to fix the problem...
'Assigns the variable "rngCash" to the first non-empty cell in "B1"
With ThisWorkbook
.Sheets(4).Select
‘Object variable or With block variable not set : Variant/Integer’
Set rngCash = DestSh.Range("B1").End(xlDown).Offset(1, 0)
rngCash.Cells(1, 1).Value = Dcell.Value
rngCash.Cells(2, 1).Value = "Cash"
rngCash.Cells(3, 1).Value = " ----------"
rngCash.Cells(4, 1).Value = Rcell.Value
rngCash.Cells(5, 1).Value = " ---
rngCash.Cells(6, 1).Value = Abbrev
rngCash.Cells(7, 1).Value = " ---"
End With
Or this method...
'Assigns the variable "rngCash" to the first non-empty cell in "B1"
With ThisWorkbook
.Sheets(4).Select
‘Object variable or With block variable not set : Variant/Integer’
Set rngCash = DestSh.Range("B1").End(xlDown).Offset(1, 0)
http://www.excelforum.com/images/editor/color.gif
rngCash.Item1).Value = Dcell.Value
rngCash.Item(2).Value = "Cash"
rngCash.Item(3).Value = " ----------"
rngCash.Item(4).Value = Rcell.Value
rngCash.Item(5).Value = " ---
rngCash.Item(6).Value = Abbrev
rngCash.Item(7).Value = " ---"
End With
In VBA it is rare to have to select an object perform performing an action on it. You will see I removed the rngCash.Selectstatements.
Bookmarks