PDA

View Full Version : Help with filling data in relative cells



GrayLatto
11-24-2007, 09:29 AM
Dear excel experts,

I needed somebody's help concerning an issue I cannot solve. Here goes:

In the file that I have attached, I want to be able to paste in information cut from another workbook. This cut information is to be pasted into the row just above the most recent entry (in this case B4). I know for instance, that you could do CTRL Down after selecting Range B1, which would take you to cell B5, but what is the code to move up one cell?

The most recent entry will not always be cell B5, so, I do not want the code that does the following:

range("B:4).select

but rather I wanted a code that would just move up a cell from any cell.

I know this may sound confusing, but any help would be greatly appreciated, as I have such limited skills with computers.

Thanks again

lucas
11-24-2007, 09:50 AM
This is set up to work on selection change....you must put the code in the sheet code module for it to work as is but you could incororate it into a regular code module if it works for you.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Const WS_RANGE As String = "B2:B6"
On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
.Offset(-1, 0).Select
'put your paste code here instead of the select
End With
End If
ws_exit:
Application.EnableEvents = True
End Sub


Edit: see attached