ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,226
- Office Version
- 2007
- Platform
- Windows
Hi,
I currently use the coe below which does what its supposed to.
I thought as opposed to deleting the customer i would keep the records maybe for a later use.
So the current values are in columns A5:K then down the page & i thought we would paste them in columns P5:Z & down the page
Please can you advise how i would edit the code so it DOESNT delete the records BUT just paste them in the columns mentioned.
Over time the records list will become longer so it needs to be pasted in the next row after the row with values
I currently use the coe below which does what its supposed to.
I thought as opposed to deleting the customer i would keep the records maybe for a later use.
So the current values are in columns A5:K then down the page & i thought we would paste them in columns P5:Z & down the page
Please can you advise how i would edit the code so it DOESNT delete the records BUT just paste them in the columns mentioned.
Over time the records list will become longer so it needs to be pasted in the next row after the row with values
Rich (BB code):
Option Explicit
Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Dim i As Long
Dim lr As Long
Dim sh As Worksheet
Set sh = Sheets("GRASS")
With ListBox1
sh.Rows(.ListIndex + 5).Delete
lr = sh.Range("B" & Rows.Count).End(xlUp).Row
If lr > 4 Then .RowSource = sh.Name & "!A5:B" & lr
For i = 0 To .ListCount - 1
If .Selected(i) Then .Selected(i) = False
Next
End With
Unload DeleteCustomer
Range("A5").Select
End Sub
Private Sub UserForm_Initialize()
Dim lr As Long
lr = Sheets("GRASS").Range("B" & Rows.Count).End(xlUp).Row
If lr > 4 Then ListBox1.RowSource = "GRASS!A5:B" & lr
End Sub