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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T15:45:46+00:00 2026-05-16T15:45:46+00:00

I have been trying to make a VBA code to do the following. I

  • 0

I have been trying to make a VBA code to do the following.

I have 2 Sheets, one named Pay_balance and the other Debtor_list. The Debtor_list Sheet is a Table from Cells A2:B13; A1 & B1 are Headers (“Debtors” and “Balance”). Both columns have names assigned (“Alldebtor” – A2:A13 & “Allbalance” B2:B13). On the Pay_balance sheet I have a drop-down list using Data Validation (Source) “Alldebtors” on F18 A Cell to input a Value on G18 And the current Balance of the “Alldebtors” Customer selected on F18 in Cell H18 using the formula below:

=VLOOKUP(F18,Debtor_list!A2:B13,2,FALSE)

I then have a pay Button using the VBA Code;

Sub Pay_Click()

    mycount = Range("G18") + Range("H18") Range("a1") = mycount

    MsgBox "You have just Credited $" & Range("G18") & vbCrLf & "Your Account Balance is now: " & mycount

    Application.Goto Reference:="Creditbox" 
    Selection.ClearContents 

    Application.Goto Reference:="Balance_Debtor" 
    Selection.ClearContents 

    Sheets("Menu").Select 
End Sub

The result of G18 + H18 is “mycount” it currently pastes the result in A1 of the “Pay_balance” Sheet and displays a MSG Box, what I need is for it to replace the value returned by the VLOOKUP Formula on the “Debtor_list” Sheet being the Customers new Balance, so when I return to the “Pay_balance” sheet select the persons name from F18 it displays their new Balance being the “mycount” in H18.

  • 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-16T15:45:46+00:00Added an answer on May 16, 2026 at 3:45 pm
    Sub Pay_Click() 
    
        Name = Worksheets("pay_balance").Range("F18").Value 
        Amount = CSng(Worksheets("pay_balance").Range("G18").Value) 
    
        If Name = "" Then 
            MsgBox "Select Debtor" 
            Exit Sub 
        End If 
    
        DebtorRow = 1 
        Do 
            TempName = Worksheets("Debtor_list").Range("A" & DebtorRow).Value 
            If TempName = Name Then 
                DebtorBalance = CSng(Worksheets("Debtor_List").Range("B" & DebtorRow).Value) 
                Exit Do 
            End If 
            DebtorRow = DebtorRow + 1 
        Loop Until TempName = "" 
    
        If TempName = "" Then 
            MsgBox "Debtor not found" 
            Exit Sub 
        End If 
    
    
        Worksheets("Debtor_List").Range("B" & DebtorRow).Value = DebtorBalance + Amount 
    
        MsgBox "You have just Credited $" & Range("G18") & vbCrLf & "Your Account Balance is now: " & Range("H18") 
    
        Application.Goto Reference:="Creditbox" 
        Selection.ClearContents 
    
        Application.Goto Reference:="Balance_Debtor" 
        Selection.ClearContents 
    
        Sheets("Menu").Select 
    
    End Sub 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to make a cash register like code, where the user
I have been trying to make OOP PHP5 code. But I think my attempts
I have been trying to make something work with JQuery. I have the following
I have been trying to make my website performs well. One way that may
I have been trying to make a simple web service and have been following
I have been trying to make a cylinder in renderscript. This is the code
Have have been trying to make a validator for my xml files. I have
I have been trying to make custom radio buttons using HTML, CSS, and JavaScript.
I have been trying to make a div fade in evey 30sec and out
I have been trying to make the sub-menu horizontal. In my HTML it looks

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.