View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Gotroots Gotroots is offline
external usenet poster
 
Posts: 114
Default Cell not selecting

Hello,

I want rng to be the cell the value of €śB9€ť is pasted into.

For example:
€śTest Data€ť is in €śB9€ť and when the code is run €śTest Data€ť is inserted into
€śB23€ť the first blank cell in €śB10:B€ť

When you say €śit is never set to anything€ť how should this be done.

Gotroots

"Mike H" wrote:

Hi,

Rng isn't selecting because it is never set to anything so it will fail.
What do you want Rng to be?

Mike

"Gotroots" wrote:

The last blank cell containing the value of "B9" does not rng.Select. Much
appreciate if someone could advise me as to why.

If IsEmpty(Range("b9")) Then
MsgBox "No record found in B9.", vbInformation
Else
lngLastRow = Cells(Rows.Count, "B").End(xlUp).Row + 1

If lngLastRow <= 10 Then
Range("B10").Value = Range("B9").Value
Else
Cells(lngLastRow, "B").Value = Range("B9").Value
If rng Is Nothing Then
Else
rng.Select
End If
End If
End If

End Sub