J
JonathanK1
Me again (sorry, I've been posting quite a bit, I know - but I'm almos
finished).
Below is the macro I have. When I run it, it opens a spreadsheet i
another folder and pulls from it, then opens a new workbook to paste i
into. What I'd like to do is have the data paste into the workbook th
macro is being run from. So, no new workbook. I'd like it to past
into the current/active workbook, the one with the macro in it (and i
would be nice if I could specify the range it pastes into too - startin
A5 to Q5, for example.
I think part of the problem is the add part below, but I've replaced i
with "active workbook" (and a dozen variations) and it only errors out.
Sub Button6_Click()
Dim TheAnswer As String
Set wb1 = Workbooks.opm (Filename:="blahblahblah.xlsm"
Dim working As Worksheet, dumping As Workbook
Set working = ActiveSheet
TheAnswer = LCase$(InputBox("Enter state below"))
Set dumping = Workbooks.Add <-------------------------is this th
problem?
For x = 1 To 17
working.Rows(x).EntireRow.Copy
dumping.Activate
ActiveSheet.Paste
ActiveCell.Offset(1).Select
Next
For x = 1 To working.Cells.SpecialCells(xlCellTypeLastCell).Row
If LCase$(working.Cells(x, 8).Value) = TheAnswer Then
working.Rows(x).EntireRow.Copy
dumping.Activate
ActiveSheet.Paste
ActiveCell.Offset(1).Select
End If
etc etc etc
finished).
Below is the macro I have. When I run it, it opens a spreadsheet i
another folder and pulls from it, then opens a new workbook to paste i
into. What I'd like to do is have the data paste into the workbook th
macro is being run from. So, no new workbook. I'd like it to past
into the current/active workbook, the one with the macro in it (and i
would be nice if I could specify the range it pastes into too - startin
A5 to Q5, for example.
I think part of the problem is the add part below, but I've replaced i
with "active workbook" (and a dozen variations) and it only errors out.
Sub Button6_Click()
Dim TheAnswer As String
Set wb1 = Workbooks.opm (Filename:="blahblahblah.xlsm"
Dim working As Worksheet, dumping As Workbook
Set working = ActiveSheet
TheAnswer = LCase$(InputBox("Enter state below"))
Set dumping = Workbooks.Add <-------------------------is this th
problem?
For x = 1 To 17
working.Rows(x).EntireRow.Copy
dumping.Activate
ActiveSheet.Paste
ActiveCell.Offset(1).Select
Next
For x = 1 To working.Cells.SpecialCells(xlCellTypeLastCell).Row
If LCase$(working.Cells(x, 8).Value) = TheAnswer Then
working.Rows(x).EntireRow.Copy
dumping.Activate
ActiveSheet.Paste
ActiveCell.Offset(1).Select
End If
etc etc etc