![]() |
enter value line by line
Hi, I’m just to new to this excel programming, can you teach me how t write this program? My program is like this, I have one command button, every time when I press the button, it wil store current date time to first row first column (A1), after that, i I press again, it will store another current date time to the followin row (A2). For this first part, I already figure out( finally ^_^’), bu come to second part, I have some problem… I don know how to move th data to second column. So, can you teach me how to write this part? Thx you Ave_av -- ave_av ----------------------------------------------------------------------- ave_ave's Profile: http://www.excelforum.com/member.php...fo&userid=1642 View this thread: http://www.excelforum.com/showthread.php?threadid=27795 |
enter value line by line
At what point will it move to the second column?
Private Sub Command_button1_click() Dim rng as Range, rng1 as Range set rng1 = Range("A1") if isempty(rng1) then set rng = rng1 elseif isempty(rng1(2)) then set rng = rng1(2) else set rng = rng1.End(xldown)(2) end if rng.Value = now rng.format = "mm/dd/yyyy hh:mm:ss") rng.EntireColumn.Autofit End Sub -- Regards, Tom Ogilvy "ave_ave" wrote in message ... Hi, I'm just to new to this excel programming, can you teach me how to write this program? My program is like this, I have one command button, every time when I press the button, it will store current date time to first row first column (A1), after that, if I press again, it will store another current date time to the following row (A2). For this first part, I already figure out( finally ^_^'), but come to second part, I have some problem. I don know how to move the data to second column. So, can you teach me how to write this part? Thx you Ave_ave -- ave_ave ------------------------------------------------------------------------ ave_ave's Profile: http://www.excelforum.com/member.php...o&userid=16425 View this thread: http://www.excelforum.com/showthread...hreadid=277951 |
enter value line by line
How do you know when to start on the second column?
Maybe if you've already entered values in the first 10 rows? This may be a little overkill, since it checks a few things that may not need to be checked. Option Explicit Sub testme() Dim myCell As Range Dim iCol As Long Set myCell = Nothing With ActiveSheet For iCol = 1 To .Columns.Count '256 Set myCell = .Cells(.Rows.Count, iCol).End(xlUp) If IsEmpty(myCell) Then 'do nothing Else Set myCell = myCell.Offset(1, 0) End If If myCell.Row < 11 Then Exit For Else 'keep going End If Next iCol End With If myCell Is Nothing Then MsgBox "ran out of columns!!!" Else With myCell .Value = Date .NumberFormat = "mm/dd/yyyy" End With End If End Sub ave_ave wrote: Hi, I’m just to new to this excel programming, can you teach me how to write this program? My program is like this, I have one command button, every time when I press the button, it will store current date time to first row first column (A1), after that, if I press again, it will store another current date time to the following row (A2). For this first part, I already figure out( finally ^_^’), but come to second part, I have some problem… I don know how to move the data to second column. So, can you teach me how to write this part? Thx you Ave_ave -- ave_ave ------------------------------------------------------------------------ ave_ave's Profile: http://www.excelforum.com/member.php...o&userid=16425 View this thread: http://www.excelforum.com/showthread...hreadid=277951 -- Dave Peterson |
All times are GMT +1. The time now is 03:43 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com