Ok,
I am at my wits end. Multiple problems in my sheet. First I will paste my code. The excel sheet is also added as an attachment.
Sub mycheck()
Dim mcount As Range
Dim i As Long
Dim istart As Integer
Sheets("Sheet1").Select
istart = 4
Set cl = Range("A" + CStr(istart))
Set mcount = Range("I1")
For i = istart To (istart + mcount - 1)
If IsEmpty(cl.Value) = True Then
Range("J" + CStr(istart - 1)).Select
Selection.Copy
Range("J" + CStr(istart)).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Else
Range("A" + CStr(istart)).Select
Selection.Copy
Range("J" + CStr(istart)).Select
ActiveSheet.Paste
End If
istart = istart + 1
Next i
End Sub
Problem 1:- I am trying to program the following condition. Pls refer excel sheet.Sheet1
=if(A4="",A3,A4) and loop it till the value in cell I1. On executing the above code, it only returns the value as 1 which means only the if condition is executed. The else condition never gets activated at the first point (cell A67 in this sheet) where it should be activated.
Problem 2:- The "for i = " command is not running properly, although it runs properly when I put in actual numeric values like 4 to 768 (which is my count in cell I1), is there a error in syntax.
Problem 3:- I am also trying to program the following condition =value(left(B4,$G$1)) and loop it till the value in cell I1. But have no clue as to what the syntax will be.
Please, i know its rather long, but help me out on this
Reagrds,
Debayan
Bookmarks