Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
WTG
 
Posts: n/a
Default Textbox.caption to cell if empty, how?

I have a userform with a text box, that I've typed some information
into.
I now want to save that information to cell B1 on my "EmpData"
worksheet. but only if that cell is empty. if it's not, then writh the
text to cell B2.

What I thought I'd do was write an if statement that basicly says

if B(VAR)=" " Then
EmpData!B1 = TxtBox.caption
if not then Var=var+1

then just have it repeat itself over again.

and keep doing this adding a 1 to the Var until it finds a empty cell.

( B1,B2,B3,B4.....)

Can this be done?

I don't know VBA, and my VB is more then a little rusty.

Thanks for any help you can give me.

Wally
  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default

Wally,

Try this

With Worksheets("Sheet1")
cLastRow = .Cells(Rows.Count,"B").End(xlUp).Row
if cLastRow =1 And .Cells(cLastRow+1,"B").Value Then
Else
cLastRow = cLastRow + 1
End If
.Cells(cLastRow,"B").Value = TextBox1.Text
End With

--

HTH

RP
(remove nothere from the email address if mailing direct)


"WTG" wrote in message
...
I have a userform with a text box, that I've typed some information
into.
I now want to save that information to cell B1 on my "EmpData"
worksheet. but only if that cell is empty. if it's not, then writh the
text to cell B2.

What I thought I'd do was write an if statement that basicly says

if B(VAR)=" " Then
EmpData!B1 = TxtBox.caption
if not then Var=var+1

then just have it repeat itself over again.

and keep doing this adding a 1 to the Var until it finds a empty cell.

( B1,B2,B3,B4.....)

Can this be done?

I don't know VBA, and my VB is more then a little rusty.

Thanks for any help you can give me.

Wally



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Textbox.caption to cell if empty, how? WTG Excel Discussion (Misc queries) 2 February 27th 05 04:03 AM
Text wider than one cell is not displayed in the next empty cell Len Pace Excel Discussion (Misc queries) 5 February 18th 05 12:24 AM
Function making cell really "empty" Arvi Laanemets Excel Worksheet Functions 2 January 31st 05 05:23 PM
make a cell empty based on condition mpierre Charts and Charting in Excel 2 December 29th 04 01:01 PM
GET.CELL Biff Excel Worksheet Functions 2 November 24th 04 07:16 PM


All times are GMT +1. The time now is 10:57 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"