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

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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