Thread: macro help
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Office_Novice Office_Novice is offline
external usenet poster
 
Posts: 245
Default macro help

I think this is the loop you asked for. but the rest is a little fuzzy. could
you clairify?

Sub DoStuff()

Dim YourRange As Range
Dim ALastrow As Long
Dim i As Variant
Dim ws As Worksheet
Dim x As Integer

ALastrow = Cells(Cells.Rows.Count, "A").End(xlUp).Row
Set YourRange = Range("A1:A" & ALastrow)
Set ws = ActiveWorkbook.Worksheets(1)
x = 1

For Each i In YourRange
ws.Cells(x, 4).Value = "Not Sure What your trying to do"
x = x + 1
Next
End Sub


"timmulla" wrote:

I would greatly appreciate if somebody could help me out creating a macro.


I need to create a lastRow variable from column B. Im not sure if this will
work.

Dim lastRow As String
lastRow = Range(B2).End(xlDown).Row


Then I need to loop from A2 to A & lastRow.

During the loop:

If it finds a number 0 in column A

Then store the corresponding number two cells to the right (column C) as a
variable.

Then go over to column D and place number 1s downward (as many times as the
stored variable number).


Any help would be appreciated

--
Regards,

timmulla