Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8860735
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:19:29+00:00 2026-06-14T15:19:29+00:00

I have produced this code to sit on a button that belongs to a

  • 0

I have produced this code to sit on a button that belongs to a UserForm…

    Private Sub CommandButton1_Click()

Dim lngWriteRow As Long

Dim ws As Worksheet
Set ws = Worksheets("Sheet1")

NextRow = Cells(Rows.Count, 2).End(xlUp).Row + 1

lngWriteRow = ws.Cells(Rows.Count, 2).End(xlUp) _
.Offset(12, 0).NextRow

    ws.Range("B" & lngWriteRow) = TextBox1.Value
    ws.Range("C" & lngWriteRow) = TextBox2.Value
    ws.Range("D" & lngWriteRow) = TextBox3.Value
    ws.Range("E" & lngWriteRow) = ComboBox1.Value
    ws.Range("F" & lngWriteRow) = TextBox4.Value
    ws.Range("G" & lngWriteRow) = ComboBox2.Value

End Sub

It wont automatically move to the next row, and will overwrite the row number 14, when i want it to update 15 when 14 has data in it, then when 15 does, update 16 and so on…

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T15:19:30+00:00Added an answer on June 14, 2026 at 3:19 pm

    Since you’re only placing data in columns B onwards, you should look at those columns, not column A as your code is currently doing. This should fix it:

    lngWriteRow = ws.Cells(Rows.Count, 2).End(xlUp).Offset(12, 0).Row + 1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have produced some VBA code to resolve this problem : Private Sub Workbook_SheetChange(ByVal
I have code produced by our proprietry system in the Eltron Programming Language: This
I have this code that i use to upload files on the server. But
I have produced this C++ code: class TestInstance { public: TestInstance(); ~TestInstance(); static TestInstance&
A friend, produced this code, and I have refined it a little to suit
I have a webservice that produce XML result. I have been working on this
I have a JavaScript app that produces a string. I want to transfer this
I have a Silverlght library project that produces a dll output. This project utilises
I have some data (produced by a legacy application) that I know is invalid
There is the code: Private Sub InsertItemInCache(Of T)(ByVal item As CachedItem(Of T), ByVal dependency

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.