VBA Addme

Eve05

New Member
Joined
Sep 21, 2020
Messages
5
Office Version
  1. 365
Platform
  1. Windows
Hi

I have a VBA that i'm able to select records from the userform and add them to a new worksheet, however I need the data to start of D9 how do I go about changing the code for this to happen

VBA Code:
Dim addme As Range
    Dim x As Integer
    Set addme = Sheet1.Cells(Rows.Count, 4).End(xlUp).Offset(1, 0)
    For x = 0 To Me.lstData.ListCount - 1
        If Me.lstData.Selected(x) Then
            addme = Me.lstData.List(x)
            addme.Offset(0, 1) = Me.lstData.List(x, 1)
            addme.Offset(0, 2) = Me.lstData.List(x, 2)
            addme.Offset(0, 3) = Me.lstData.List(x, 3)
            addme.Offset(0, 4) = Me.lstData.List(x, 4)
            addme.Offset(0, 5) = Me.lstData.List(x, 5)
            addme.Offset(0, 6) = Me.lstData.List(x, 6)
            addme.Offset(0, 7) = Me.lstData.List(x, 7)
            addme.Offset(0, 8) = Me.lstData.List(x, 8)
            addme.Offset(0, 9) = Me.lstData.List(x, 9)
            addme.Offset(0, 10) = Me.lstData.List(x, 10)
            
            Set addme = addme.Offset(1, 0)
        End If
    Next x
    For x = 0 To Me.lstData.ListCount - 1
        If Me.lstData.Selected(x) Then Me.lstData.Selected(x) = False
    Next x
End Sub
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
56,477
Office Version
  1. 365
Platform
  1. Windows
Change
VBA Code:
Set addme = Sheet1.Cells(Rows.Count, 4).End(xlUp).Offset(1, 0)
to
VBA Code:
Set addme = Sheet1.Range("D9")
 

Watch MrExcel Video

Forum statistics

Threads
1,129,410
Messages
5,636,118
Members
416,900
Latest member
Mokor

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top