Combining results of two textbox values into one textbox...

chazrab

Well-known Member
Joined
Oct 21, 2006
Messages
884
Office Version
  1. 365
Platform
  1. Windows
This code works perfectly
Code:
Private Sub UserForm_Initialize()
Dim x As Range
Application.EnableEvents = False
Application.ScreenUpdating = False
   Sheets("Budget").Select
      For i = colnum + 1 To 54
      Cells(30, i).Value = Cells(30, i - 1).Value - Cells(18, i).Value 
      If Cells(30, i) = 0 Then
         TextBox1.Value = "VISA balance is 0 at col  " & i & "  " & "  and week  " & Cells(2, i)
         Range(Cells(30, i + 1), Cells(30, 105)).ClearContents
         Exit For
      End If                                                           
     Next
      For i = colnum + 1 To 54
      Cells(31, i).Value = Cells(31, i - 1).Value - Cells(25, i).Value
      If Cells(31, i) = 0 Then
           TextBox2.Value = "VISA PLAT Balance is 0 at col  " & i & "  and week  " & Cells(2, i)
         Range(Cells(31, i + 1), Cells(31, 105)).ClearContents
         Exit For
      End If
   Next
 Application.EnableEvents = True
 Application.ScreenUpdating = True
End Sub
except that it puts the calculated value of VISA PLAT Balance into a separate textbox, Textbox2.

How can this code be rewritten so that it includes (or combines) the results of BOTH For-End For calculations into just ONE textbox, Textbox1
on two separate lines ?


Thanks for anyone's help.

cr
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Try
Code:
TextBox1.Value = TextBox1.Value & vblf & "VISA PLAT Balance is 0 at col  " & i & "  and week  " & Cells(2, i)
 
Upvote 0

Forum statistics

Threads
1,215,332
Messages
6,124,314
Members
449,153
Latest member
JazzSingerNL

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