Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Getting a Cell Value into a Macro!
I have this macro
Sub Group() Dim Cel As Integer Range("B5").Select For Cel = 1 To 115 Range(Selection, Selection.End(xlDown)).Select Range(Selection, Selection.End(xlToRight)).Select Selection.Rows.Group Selection.End(xlDown).Select Selection.End(xlDown).Select Next Range("A1:C1").Select ActiveSheet.Outline.ShowLevels RowLevels:=1 End Sub What i need it to do is in the "For Cel = 1 To 115" line is to have the 115 as value from a cell if this is possible. Example: For Cel = 1 To "E1's value" is this possible? Do i need to Dim the value in the cell or anything? Thanks in advance. |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Getting a Cell Value into a Macro!
Dim Cel As Integer
Dim x as Integer x = Range("E1").value Range("B5").Select For Cel = 1 To x try this "N1KO" wrote: I have this macro Sub Group() Dim Cel As Integer Range("B5").Select For Cel = 1 To 115 Range(Selection, Selection.End(xlDown)).Select Range(Selection, Selection.End(xlToRight)).Select Selection.Rows.Group Selection.End(xlDown).Select Selection.End(xlDown).Select Next Range("A1:C1").Select ActiveSheet.Outline.ShowLevels RowLevels:=1 End Sub What i need it to do is in the "For Cel = 1 To 115" line is to have the 115 as value from a cell if this is possible. Example: For Cel = 1 To "E1's value" is this possible? Do i need to Dim the value in the cell or anything? Thanks in advance. |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Getting a Cell Value into a Macro!
Thanks fella,
I found a slightly easier way using "For Cel = 1 To Range("E1").Value" "akphidelt" wrote: Dim Cel As Integer Dim x as Integer x = Range("E1").value Range("B5").Select For Cel = 1 To x try this "N1KO" wrote: I have this macro Sub Group() Dim Cel As Integer Range("B5").Select For Cel = 1 To 115 Range(Selection, Selection.End(xlDown)).Select Range(Selection, Selection.End(xlToRight)).Select Selection.Rows.Group Selection.End(xlDown).Select Selection.End(xlDown).Select Next Range("A1:C1").Select ActiveSheet.Outline.ShowLevels RowLevels:=1 End Sub What i need it to do is in the "For Cel = 1 To 115" line is to have the 115 as value from a cell if this is possible. Example: For Cel = 1 To "E1's value" is this possible? Do i need to Dim the value in the cell or anything? Thanks in advance. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro to transfer contents of 'Selected' cell to alternate cell. | Excel Worksheet Functions | |||
'IF' Macro to insert cell contents to alternate cell if cell not e | Excel Worksheet Functions | |||
Macro to Insert Current Date into cell - Macro to "Save As" | Excel Worksheet Functions | |||
macro to move part of cell contents to another cell | Excel Discussion (Misc queries) | |||
using a cell value to control a counter inside a macro and displaying macro value | Excel Worksheet Functions |