Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Robin,
Sorry - I assumed rgWTBaEnd was a row number. I'm glad you were able to get the solution you needed from one of the other folks. Cheers, Eric "Robin" wrote: EricG, After trying Mike H's below I trie yours and got the same Run Time Error 13. The rgWTBaEnd is a range name which refers to a single cell. Yours, as MikeH's seems like it should work. Coming from Access VBA, it's these references in Excel that are really confusing. Is the & ":" & in your line trying to create a range from cells as you would do if you were keying in a range in a formula? I tried removing that and the second reference to my range so it would only refer to the single cell range. Putting the range name in quotes gives me the Error 13 above. If I remove the quotes I get Run Time error 1004 - Application Defined or Object... Sorry I'm not getting what is probably simple. Or is it my reference to a range name that is throwing everything off? I just assumed I could use range names in VBA. Thank you, Robin "EricG" wrote: Oops - left out the second "&" after the ":" in the formulas. I corrected below. "EricG" wrote: Something like this? ActiveSheet.Rows(rgWTBaEnd & ":" & rgWTBaEnd + intAInsert-1).Select Selection.Insert Shift:=xlDown This will insert the new rows ABOVE row rgWTBaEnd. If you want to insert the new rows beneath that row, use: ActiveSheet.Rows(rgWTBaEnd + 1 & ":" & rgWTBaEnd + intAInsert).Select Selection.Insert Shift:=xlDown HTH, Eric "Robin" wrote: I'm pretty good with Access VBA but new to Excel. Isn't there a simple way to go to a cell and insert x number of rows based on an integer variable. The cell I want to go to is rgWTBaEnd and the number of rows I wnat to insert is intAInsert. I can't believe one must do what I'm seeing in this discussion group for something that simple. Help me please. Thanks, Robin |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
IF formula-simple question; simple operator | Excel Discussion (Misc queries) | |||
Simple problem, simple formula, no FUNCTION ! | Excel Worksheet Functions | |||
Simple Simple Excel usage question | Excel Discussion (Misc queries) | |||
Make it more simple or intuitive to do simple things | Charts and Charting in Excel | |||
simple question, hopefully a simple answer! | Excel Programming |