ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   looking for the empty cell (https://www.excelbanter.com/excel-programming/348244-looking-empty-cell.html)

Norman Jones

looking for the empty cell
 
Hi Dok112,

Try something like:

Dim SH As Worksheet
Dim LCellA As Range
Dim LCellB As Range

Set SH = ActiveSheet '<<==== CHANGE

Set LCellA = SH.Cells(Rows.Count, "A").End(xlUp)(2)
Set LCellB = SH.Cells(Rows.Count, "B").End(xlUp)(2)


LCellA.Value = Textbox1.Value
LCellB.Value = Textbox2.Value


---
Regards,
Norman


"dok112" wrote in
message ...

Hello all,

I can't figure out how to make this work. I was thinking about doing a
loop, but it just doesnt seem to work correctly. What I have, is a
userform, and the information needs to be added to the next available
open cell in a corresponding column. I have the relationships down
below.

Column A goes to tg1.textbox1.value
Column B goes to tg1.textbox2.value
etc.

Can anyone help me out? I greatly appreciate it!! :)


--
dok112
------------------------------------------------------------------------
dok112's Profile:
http://www.excelforum.com/member.php...o&userid=10581
View this thread: http://www.excelforum.com/showthread...hreadid=493953




evgny[_2_]

looking for the empty cell
 
You can try this.


Private Sub TextBox1_Change()
If TextBox1 < "" Then

Dim colA As Double
colA = Cells(Rows.Count, "A").End(xlUp).Row + 1

ActiveSheet.Range("A" & colA).Value = TextBox1.Value
TextBox1 = ""
End If
End Sub

Regards
Yngve


dok112[_76_]

looking for the empty cell
 

Hello all,

I can't figure out how to make this work. I was thinking about doing
loop, but it just doesnt seem to work correctly. What I have, is
userform, and the information needs to be added to the next availabl
open cell in a corresponding column. I have the relationships dow
below.

Column A goes to tg1.textbox1.value
Column B goes to tg1.textbox2.value
etc.

Can anyone help me out? I greatly appreciate it!! :

--
dok11
-----------------------------------------------------------------------
dok112's Profile: http://www.excelforum.com/member.php...fo&userid=1058
View this thread: http://www.excelforum.com/showthread.php?threadid=49395



All times are GMT +1. The time now is 01:15 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com