Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Creating a loop in a Macro to do through data

Hi,

I am trying to create a Macro in Excel to go through a list of names on one
sheet, and starting from the top pick one up at a time and perform the action
prescribed by the macro. I need some help with some coding in Excel. I have
got the action setup in the macro, however I am unable to get the macro to
change what its looking at.

See code below, in this line of Code (ActiveCell.FormulaR1C1 =
"=Entities!R[-3]C[-1]"), I would like it to change the cell each time its
performed the action and keep changing and continuing the action until it
arrives at a blank cell.

Sub EMEA_Reporting()
'
' EMEA_Reporting Macro
' Macro recorded 01/04/2009 by KRazaq
'

'
ActiveCell.FormulaR1C1 = "=Entities!R[-3]C[-1]"
Range("B6").Select
Sheets("Base").Select
Sheets("Base").Copy Befo=Sheets(1)
Selection.ShapeRange.Delete
Cells.Select
ActiveWorkbook.BreakLink Name:="C:\Hyperion\SmartView\bin\HsTbar.xla",
Type _
:=xlExcelLinks
End Sub


Thanks for you help.

Khurram
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 135
Default Creating a loop in a Macro to do through data

On Apr 1, 11:12*am, khurram_razaq
wrote:
Hi,

I am trying to create a Macro in Excel to go through a list of names on one
sheet, and starting from the top pick one up at a time and perform the action
prescribed by the macro. I need some help with some coding in Excel. I have
got the action setup in the macro, however I am unable to get the macro to
change what its looking at.

See code below, in this line of Code (ActiveCell.FormulaR1C1 =
"=Entities!R[-3]C[-1]"), I would like it to change the cell each time its
performed the action and keep changing and continuing the action until it
arrives at a blank cell.

Sub EMEA_Reporting()
'
' EMEA_Reporting Macro
' Macro recorded 01/04/2009 by KRazaq
'

'
* * ActiveCell.FormulaR1C1 = "=Entities!R[-3]C[-1]"
* * Range("B6").Select
* * Sheets("Base").Select
* * Sheets("Base").Copy Befo=Sheets(1)
* * Selection.ShapeRange.Delete
* * Cells.Select
* * ActiveWorkbook.BreakLink Name:="C:\Hyperion\SmartView\bin\HsTbar.xla",
Type _
* * * * :=xlExcelLinks
End Sub

Thanks for you help.

Khurram


Khurram,

Here is some code to pick up the contiguous cells in a range (i.e.
starting at A1 and looking down the column until there is a blank
cell). I'm not quite sure what you trying to accomplish, so the code
below has syntax necessary to pick up a range to loop through and then
loops through each item in the range.

Best,

Matt Herbert

Sub LoopThroughCells()

Dim rngData As Range
Dim rngItem As Range

With Worksheets(1) '<< index name or number here
Set rngData = .Range("A1", .Range("A1").End(xlDown))
End With

For Each rngItem In rngData
MsgBox rngItem.Value
Next

End Sub
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/Method of Importing DATA in a loop Faraz A. Qureshi Excel Discussion (Misc queries) 2 August 5th 09 07:34 AM
Creating a macro for data input. Gunti Excel Discussion (Misc queries) 2 February 3rd 09 08:06 AM
Creating a macro to formatt data ATanker62 Excel Programming 3 August 23rd 06 02:12 PM
Creating macro to lookup data tryer Excel Discussion (Misc queries) 1 August 3rd 05 08:37 PM
Excel macro to loop through worksheets and graph data from each worksheet deb Excel Programming 5 October 17th 03 05:34 PM


All times are GMT +1. The time now is 11:38 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"