VBA: Copying array from userform to data sheet, getting same data in 2 rows

jedwardo

Board Regular
Joined
Aug 21, 2012
Messages
122
Hi everyone,

I've got this array copying to a dynamic named range (Data) to sheet (Data) but it's filling 2 rows with duplicate data instead of just one. Can't figure out what I'm doing wrong here.

Code:
Private Sub cbWoodReturn_Click()
Dim arrList
Dim oTab As MSForms.Tab
Dim var As Variant
    
    
    With ufrooms
        If .tbxRooms.Value = "" Then: .cbxRooms.DropDown: GoTo fin
        
        arrList = Array(.tbxRooms.Text, .tsWood.SelectedItem.Caption, .tsWoodRun.SelectedItem.Caption, .tbxWoodQuant.Text, .tbxWoodPrice.Text, .tbWoodPrime.Tag, .tbWoodCaulk.Tag, .tbWoodPutty.Tag, .tbWoodStain.Tag)
        worksheets("Data").Range("Data") = arrList
        
    End With
    
    With Me.tsWoodRun
        If .Value < .Tabs.Count - 1 Then 'the active tab isn't the last tab
            For Each oTab In .Tabs
                oTab.Enabled = True
            Next oTab
            .Value = .Value + 1 'go to the next tab
            Call EnableTabStrip(Me.tsWoodRun)
        ElseIf .Value = .Tabs.Count - 1 Then
            For Each oTab In .Tabs
                oTab.Enabled = True
            Next oTab
    '            .Value = .Value + 1 'go to the next tab

            Call EnableTabStrip(Me.tsWoodRun)
        End If
        .Value = -1
    End With
    
    ufrooms.tbxPartPrice = "": ufrooms.tbxPartQuant = "": ufrooms.tbxWoodPrice = "": ufrooms.tbxWoodQuant = ""
fin:
End Sub

And here's the named range:

Code:
=OFFSET(Data!$A$6,0,0,COUNTA(Data!$A:$A),22)

Thanks in advance
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.

Forum statistics

Threads
1,225,747
Messages
6,186,792
Members
453,371
Latest member
HMX180

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
Back
Top