Inserting text to a cell

Todd_M

Board Regular
Joined
Feb 24, 2002
Messages
117
Hi-
Im using the following code to insert text into a cell 10 columns to the right of the date cell.

Sheets ("balance sheet").select
Range("d5").Select
While ActiveCell.Value <> Int(Now)
ActiveCell.Offset(1, 0).Select
Wend
ActiveCell.Offset(0, 10).Value = TextBox1.Text
End With

The problem is that I do not want to show the "balance sheet" when this command takes place. How do I write or fix this code so that when I press the commandbutton on the userform, the code lists textbox1.text , but does not show me the "balance sheet"?
thanks!
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
You could try something like this (I commented out the 'End With' piece of your code as I'm not sure why it's there): -

Dim SheetName As String

SheetName = ActiveSheet.Name
Application.ScreenUpdating = False

Sheets("balance sheet").Select
Range("d5").Select
While ActiveCell.Value<> Int(Now)
ActiveCell.Offset(1, 0).Select
Wend
ActiveCell.Offset(0, 10).Value = TextBox1.Text
'End With

Sheets("" & SheetName & "").Select
Application.ScreenUpdating = True
This message was edited by Mudface on 2002-03-04 08:24
 
Upvote 0

Forum statistics

Threads
1,223,365
Messages
6,171,654
Members
452,415
Latest member
mansoorali

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