Hi All
Been trying to figure this out all afternoon had to give up !
I have a range of cells that have been selected and copied via my macro
I am trying to get an input box to allow the user to select the location where the copied cells should be inserted.
workbook has number of sheets PN1252, PN1356, PN1458, ect ect and a summary sheet.
the summary sheet has the sheet names listed in col A, each separated by 3 rows.
The ideal senario would be that each of the copied selections on the various sheets (PN) would be inserted into the summary sheet under the relevant headings automatically, failing that a user input box where the correct location is able to be set would be ok.
All help appreciated.
Dan
Been trying to figure this out all afternoon had to give up !
I have a range of cells that have been selected and copied via my macro
I am trying to get an input box to allow the user to select the location where the copied cells should be inserted.
workbook has number of sheets PN1252, PN1356, PN1458, ect ect and a summary sheet.
the summary sheet has the sheet names listed in col A, each separated by 3 rows.
The ideal senario would be that each of the copied selections on the various sheets (PN) would be inserted into the summary sheet under the relevant headings automatically, failing that a user input box where the correct location is able to be set would be ok.
Code:
For i = 1 To ws_num
ActiveWorkbook.Worksheets(i + 2).Activate
'Subtotaling data, copying visible cells only and pasting to new location ready to be inserted
Dim lastRow As Integer
lastRow = Range("d5000").End(xlUp).row
Rows(lastRow & ":" & lastRow).Delete shift:=xlUp
ActiveSheet.Outline.ShowLevels RowLevels:=2
numRows = Cells(Rows.Count, "f").End(xlUp).row - 2
numCols = 2
Range("d1", Cells(Rows.Count, "d").End(xlUp)).SpecialCells(xlCellTypeVisible).Cells(1, 1).Select
Dim newRange As Range
Set newRange = Range(ActiveCell, ActiveCell.Offset(numRows - 1, numCols))
'MsgBox newRange.Address
newRange.Select
Selection.SpecialCells(xlCellTypeVisible).Copy
ActiveCell.Offset(0, 4).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
'Trying to use inputbox to set insert area !!! code has been edited and changed quite a bit so is probably quite wrong !
Dim N As Range
Dim sR As String, sS As String, sTemp As String
sR = Selection.Address
sS = ActiveSheet.Name
sTemp = "'" & sS & "'!" & sR
starting_ws.Activate 'goes to summary sheet
Set N = Application.InputBox(Prompt:= _
"Please select a range with your Mouse to be bolded.", _
Title:="SPECIFY RANGE", Type:=8)
Application.GoTo N
Range(sR).Copy Destination:=Range(sTemp)
Range(sR).Cut Destination:=N
Range(sTemp).Range("A1").Resize(Selection.Rows.Count, Selection.Columns.Count).Copy Destination
'Range(sTemp).Insert shift:=xlDown
Next i
All help appreciated.
Dan