Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 60
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 461
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 60
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to transfer contents of 'Selected' cell to alternate cell. Gryndar Excel Worksheet Functions 7 December 20th 08 09:58 PM
'IF' Macro to insert cell contents to alternate cell if cell not e Gryndar Excel Worksheet Functions 6 December 20th 08 05:02 PM
Macro to Insert Current Date into cell - Macro to "Save As" Guy[_2_] Excel Worksheet Functions 4 December 12th 08 08:20 PM
macro to move part of cell contents to another cell icetoad hisself Excel Discussion (Misc queries) 4 November 27th 06 07:19 PM
using a cell value to control a counter inside a macro and displaying macro value ocset Excel Worksheet Functions 1 September 10th 06 05:32 AM


All times are GMT +1. The time now is 01:21 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"