Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,388
Default Find next empty cell in column.

I need a macro to
Copy the contents of the active cell on Sheet1 to the next empty cell in
column"A" on Sheet2,
Wait for the user to enter a number in next column on the same row,
Then return to the active cell on Sheet1

Your suggestions are greatly appreciated.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Find next empty cell in column.

hi
something like this might work. example code only...

Sub transfertest()
Dim ip As String
Dim sh As Worksheet
Dim rng As Range
Set sh = ActiveSheet
Set rng = ActiveCell
ActiveCell.Copy
Sheets("sheet2").Activate
Range("a1").End(xlDown).Offset(1, 0).PasteSpecial xlPasteAll
ip = InputBox("enter something") 'change if needed
ActiveCell.Offset(0, 1).Value = ip
If MsgBox("do you want to go back to the last sheet?", vbYesNo) = vbYes Then
sh.Select
rng.Select
Else
Exit Sub
End If
End Sub

regards
FSt1

"Dave" wrote:

I need a macro to
Copy the contents of the active cell on Sheet1 to the next empty cell in
column"A" on Sheet2,
Wait for the user to enter a number in next column on the same row,
Then return to the active cell on Sheet1

Your suggestions are greatly appreciated.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Find next empty cell in column.

the bestt way of doing this is to setup some shortcut keys that activate
simple macros like the one below

Sub lastrow()

Sheets("Sheet2").Activate
mlastrow = Cells(Rows.Count, "A").End(xlUp).Row
Cells(mlastrow + 1, "A").Activate

End Sub

The above macro will move to the first empty cell in column a on worksheet
2. You can assign the macro a shortcut key by going to the worksheet menu
Tools - Macro - Options. Assign a key. This will get you to sheet 2. Going
back to sheet 1 just requires pressing the sheet 1 Tab on the bottom of the
worksheet.

"Dave" wrote:

I need a macro to
Copy the contents of the active cell on Sheet1 to the next empty cell in
column"A" on Sheet2,
Wait for the user to enter a number in next column on the same row,
Then return to the active cell on Sheet1

Your suggestions are greatly appreciated.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,388
Default Find next empty cell in column.

Thanks very much. I combined your code with Joel's and it works great.

"FSt1" wrote:

hi
something like this might work. example code only...

Sub transfertest()
Dim ip As String
Dim sh As Worksheet
Dim rng As Range
Set sh = ActiveSheet
Set rng = ActiveCell
ActiveCell.Copy
Sheets("sheet2").Activate
Range("a1").End(xlDown).Offset(1, 0).PasteSpecial xlPasteAll
ip = InputBox("enter something") 'change if needed
ActiveCell.Offset(0, 1).Value = ip
If MsgBox("do you want to go back to the last sheet?", vbYesNo) = vbYes Then
sh.Select
rng.Select
Else
Exit Sub
End If
End Sub

regards
FSt1

"Dave" wrote:

I need a macro to
Copy the contents of the active cell on Sheet1 to the next empty cell in
column"A" on Sheet2,
Wait for the user to enter a number in next column on the same row,
Then return to the active cell on Sheet1

Your suggestions are greatly appreciated.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Find next empty cell in column.

Not sure if you are using msgbox like FST1 had in his code. MSGBOX only
deals with text data. Some items like a date will get converted to text and
stay text if it is put into a MSGBOX. This may not be what you want.

"Dave" wrote:

Thanks very much. I combined your code with Joel's and it works great.

"FSt1" wrote:

hi
something like this might work. example code only...

Sub transfertest()
Dim ip As String
Dim sh As Worksheet
Dim rng As Range
Set sh = ActiveSheet
Set rng = ActiveCell
ActiveCell.Copy
Sheets("sheet2").Activate
Range("a1").End(xlDown).Offset(1, 0).PasteSpecial xlPasteAll
ip = InputBox("enter something") 'change if needed
ActiveCell.Offset(0, 1).Value = ip
If MsgBox("do you want to go back to the last sheet?", vbYesNo) = vbYes Then
sh.Select
rng.Select
Else
Exit Sub
End If
End Sub

regards
FSt1

"Dave" wrote:

I need a macro to
Copy the contents of the active cell on Sheet1 to the next empty cell in
column"A" on Sheet2,
Wait for the user to enter a number in next column on the same row,
Then return to the active cell on Sheet1

Your suggestions are greatly appreciated.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,388
Default Find next empty cell in column.

In my case InputBox is asking for a numeric value so the code works well.
I chose your method of finding the next row because there may be empty cells
above the last row.
Thanks again for the help!


"Joel" wrote:

Not sure if you are using msgbox like FST1 had in his code. MSGBOX only
deals with text data. Some items like a date will get converted to text and
stay text if it is put into a MSGBOX. This may not be what you want.

"Dave" wrote:

Thanks very much. I combined your code with Joel's and it works great.

"FSt1" wrote:

hi
something like this might work. example code only...

Sub transfertest()
Dim ip As String
Dim sh As Worksheet
Dim rng As Range
Set sh = ActiveSheet
Set rng = ActiveCell
ActiveCell.Copy
Sheets("sheet2").Activate
Range("a1").End(xlDown).Offset(1, 0).PasteSpecial xlPasteAll
ip = InputBox("enter something") 'change if needed
ActiveCell.Offset(0, 1).Value = ip
If MsgBox("do you want to go back to the last sheet?", vbYesNo) = vbYes Then
sh.Select
rng.Select
Else
Exit Sub
End If
End Sub

regards
FSt1

"Dave" wrote:

I need a macro to
Copy the contents of the active cell on Sheet1 to the next empty cell in
column"A" on Sheet2,
Wait for the user to enter a number in next column on the same row,
Then return to the active cell on Sheet1

Your suggestions are greatly appreciated.

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
Find first empty cell in column TomHull Excel Discussion (Misc queries) 1 November 9th 09 05:16 AM
Find first empty cell in column TomHull Excel Discussion (Misc queries) 2 November 9th 09 01:37 AM
find next NOT empty cell in column Max Bialystock[_2_] Excel Programming 2 July 25th 07 09:55 PM
Find a empty cell in next column Michael Excel Discussion (Misc queries) 3 June 15th 05 02:18 PM
How to find next empty cell within a column? Rick Excel Programming 5 May 27th 05 07:25 PM


All times are GMT +1. The time now is 11:08 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"