Enter Data into the top row of a blank sheet

smith914

New Member
Joined
Aug 13, 2013
Messages
2
I have the code below which captures my data onto a the sheet, and works fine when there is already data in the spreadsheet;
Code:
Private Sub btn_Add_Click()   
Dim ws As Worksheet
      Set ws = ActiveSheet ' change for the worksheet you want data to go to
      Set rngNext = ws.Range("A" & Rows.Count).End(xlUp).Offset(1)
       rngNext.Value = txt_CompanyName.Value
       Set rngNext = ws.Range("B" & Rows.Count).End(xlUp).Offset(1)
       rngNext.Value = txt_Notes.Value
       Unload Me
       frm_AddToWaitingList.Show
End Sub

However when a new sheet is added, and I try to enter the data it skips the first row, this could normally be ignored as the first row is not that important, however, I also have a piece of code that copies all the data in column "A" to be pasted into an e-mail as required. The code below is what I use to do this;

Code:
Private Sub cmb_Airline_Change()
    Sheets(cmb_Airline.Value).Select
        With Range("A1")
            Range(.Cells(1, 1), .End(xlDown)).Select
        End With
End Sub


Private Sub CommandButton1_Click()
    Selection.Copy
End Sub

When I use this code on a separate form, it skips out only selects the top two cells in column "A", I'm not sure what would be easier, to edit the select and copy code, or to edit the data entry code....or in the worst case scrap it all and write something different?

Thanks
icon10.png
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.

Forum statistics

Threads
1,214,833
Messages
6,121,869
Members
449,054
Latest member
juliecooper255

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