Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello,
I have defined several ranges with formula's in sheet2 eg: range1=A1:D5 (5rows), range2=A10:D20 (10rows), range3=A30:D37 (7rows) In sheet1:column A I have cell values range2 range2 range1 range3, etc How can I insert the matching range defined in sheet2 into sheet1, |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I wrote next Sub,
Sub InsertRange() Dim cellToReturnTo As Range Set cellToReturnTo = ActiveCell Dim sSearchValue As String sSearchValue = ActiveCell.Text Cells.Find(What:=sSearchValue, After:=ActiveCell, LookIn:=xlFormulas, LookAt _ :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _ False, SearchFormat:=False).Activate Sheets("MacroData").Select Range(sSearchValue).Select Selection.Copy Application.GoTo cellToReturnTo Selection.Insert Shift:=xlDown End Sub wich works fine if the cell values in sheet 1 are "plain" text, except they are Excel formula's, I think I have to replace "sSearchValue = ActiveCell.Text" into something else BUt I don't know what "firsttimer" wrote: Hello, I have defined several ranges with formula's in sheet2 eg: range1=A1:D5 (5rows), range2=A10:D20 (10rows), range3=A30:D37 (7rows) In sheet1:column A I have cell values range2 range2 range1 range3, etc How can I insert the matching range defined in sheet2 into sheet1, |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Selectively replace cells based on two ranges of criteria - nestedIF() statements? | Excel Discussion (Misc queries) | |||
sum quarters to years; predefined shift of ranges | Excel Discussion (Misc queries) | |||
Replace a spreadsheets named cells/ranges with exact cell address. | Excel Discussion (Misc queries) | |||
Replace a spreadsheets named cells/ranges with exact cell address. | Excel Programming | |||
Replace a spreadsheets named cells/ranges with exact cell address! | Excel Programming |