View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default macro help, please

This may give you something to work with (I'm assuming the data goes into
"Sheet1" on the Individual workbook - change if necessary)

Sub test2()
Dim TargetWkSht As Worksheet
Dim LastCell As Range
Dim TargetRow As Long

On Error Resume Next
Set TargetWkSht = Workbooks("Individual.xls").Worksheets("Sheet1")

'Exit if target workbook not open, or target
'worksheet not found
If TargetWkSht Is Nothing Then
MsgBox "Target worksheet not found!"
Exit Sub
End If
On Error GoTo 0

With TargetWkSht
'Exit if Column A is full
If .Cells(.Rows.Count, 1) < "" Then _
Exit Sub

'Find the last cell in Column A
'with data in it
Set LastCell = .Cells(.Rows.Count, 1).End(xlUp)

'Check to see if A1 is LastCell
'and does not contain data
'otherwise, select the next cell
'below it
If LastCell.Value = "" Then
TargetRow = 1
Else: TargetRow = LastCell.Row + 1
End If

'Input data
.Cells(TargetRow, 1).Value = _
InputBox("Input Data")
.Cells(TargetRow, 2).Value = _
ThisWorkbook.Name
End With

End Sub


"spirosu" wrote:


Need a marco to open up a message/text box where you're able to input
data...and then have that data transferred to another workbook once
"ok" is clicked. On the new workbook it's transferred to, I'd like it
to know to parse on the next empty row in column A, and in column B
next to it, to enter name of the workbook (file) it's coming from. The
second workbook where the info. will be parsed to will be named
"individual" for example.

Plleeeeease help!!

P.S. - I bought a number of books on amazon.com last night dedicated to
vba...so hopefully I won't be posting for help for that much longer.

:)


--
spirosu
------------------------------------------------------------------------
spirosu's Profile: http://www.excelforum.com/member.php...fo&userid=7442
View this thread: http://www.excelforum.com/showthread...hreadid=523201