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 6748307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:32:58+00:00 2026-05-26T12:32:58+00:00

The code below is supposed to get the next record when a button is

  • 0

The code below is supposed to get the next record when a button is clicked in an input sheet.

My button is named CurrRecNew on sheet3 when I click it performs the code below but it doesn’t appear to increment. Any suggestions on what I am doing wrong?

The datasheet sheet 1 has cells starting in Row A3 and going down eg

A3 1 B3 a
A4 Blank B4 b
A5 Blank B5 c
A6 2 B6 d
A7 Blank B7 f
A8 Blank B8 g
A9 Blank B9 h
A8 3 B10 …

Sub ViewLogDown()
    Dim historyWks As Worksheet
    Dim InputWks As Worksheet

    Dim lRec As Long
    Dim lRecRow As Long
    Dim lLastRec As Long
    Dim LastRow As Long
    Dim Rlen As Long
    Dim lCurrentRow As Long

    lCurrentRow = lCurrentRow + 1

    Application.EnableEvents = False

    Set InputWks = Worksheets("Sheet3")
    Set historyWks = Worksheets("Sheet1")

    With historyWks
        LastRow = .Cells(.Rows.Count, "A").End(xlUp).Offset(1, 0).Row - 1
        lLastRec = LastRow - 1
    End With

    With InputWks
        lCurrentRow = lCurrentRow + 1
        lRec = .Range("CurrRecNew").Value

        Do While Len(Cells(lCurrentRow, 1).Value) = 0
            lCurrentRow = lCurrentRow + 1
        Loop
        lCurrentRow = lCurrentRow - 1

        .OLEObjects("tbRiskID").Object.Value = historyWks.Cells(lCurrentRow, 1)
        .OLEObjects("tbRiskContext").Object.Value = historyWks.Cells(lCurrentRow, 2)
        .OLEObjects("TextBox34").Object.Value = historyWks.Cells(lCurrentRow, 3)
        .OLEObjects("tbRiskEx").Object.Value = historyWks.Cells(lCurrentRow, 4)
        .OLEObjects("tbRiskCat").Object.Value = historyWks.Cells(lCurrentRow, 5)
    End With
    Application.EnableEvents = True
End Sub
  • 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-05-26T12:32:59+00:00Added an answer on May 26, 2026 at 12:32 pm

    Your code is very confusing, you are finding the lCurrentRow on the InputWks sheet but then setting the textbox objects to the lcurrentrow on the Historywks sheet??? You need to explain clearly what each worksheet does, which sheet you want to find the next row on etc.

    I presume that the you are using the named range CurrRecNew to store the current row. And you are wanting get the current row on the historywrks sheet. Therefore as far as finding the next row which is your actual question your code should look something like this:

        Dim rFound As Range
    
        '// History sheet
        With historyWks  
            '// Get current row, you need to correctly define the sheet name which contains the CurrRecNew Range.
            lCurrentRow = InputWks.Range("CurrRecNew").Value
    
            Set rFound = .Columns(1).Find(What:="*", After:=.Cells(lCurrentRow, 1))
    
            If Not rFound Is Nothing Then
                If rFound.Row > lCurrentRow Then
                    lCurrentRow = rFound.Row
                    txtName.Text = Cells(lCurrentRow, 1).Value
                    txtPhone.Text = Cells(lCurrentRow, 2).Value
                End If
            End If
    
            '// Once again correct the sheet name here I guessed CurrRecNew was on the InputWks sheet
            InputWks.Range("CurrRecNew").Value = lCurrentRow
    
        End with
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

my code below is supposed to display N lines per inch. instead i get
So below I have a code in C++ that is supposed to invert the
I'm trying to get the code below to execute an event that triggers once
The code below is supposed to show a stack of three list boxes, each
I'm having a (probably super simple) issue. The code below is supposed to _POST
In my code below, I get this compiler error error C2236: unexpected 'class' 'Pawn'.
I have this javascript code below that uses jquery, it is suppoed to be
Code below does not run correctly and throws InvalidOperationExcepiton . public void Foo() {
Code below is not working as expected to detect if it is in design
Code below is working well as long as I have class ClassSameAssembly in same

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.