+ Reply to Thread
Results 1 to 4 of 4

Mixing For i = x to y and j = z to y for lines and columns

Hybrid View

  1. #1

    Mixing For i = x to y and j = z to y for lines and columns

    hello, this morning I have been explained how to use For expression for
    columns definitions, but I am trying without success to mix it with For
    expression for lines.
    Right now code looks like
    ______________
    Sub TEST
    For i = 4 To 32 Step 1
    For j = 3 To 6
    If Worksheets("Skew Matrix").Range(Columns(j) & i).Value = "" And CODE
    Next i
    Next j
    End Sub
    _______________
    Not working!
    I was before that writing

    If Worksheets("Skew Matrix").Range("C" & i).Value = "" And CODE

    and I do not want to repeat it for every columns...
    help??
    many thanks!
    Daniel


  2. #2
    mcg
    Guest

    Re: Mixing For i = x to y and j = z to y for lines and columns


    [email protected] napisal(a):
    > hello, this morning I have been explained how to use For expression for
    > columns definitions, but I am trying without success to mix it with For
    > expression for lines.
    > Right now code looks like
    > ______________
    > Sub TEST
    > For i = 4 To 32 Step 1
    > For j = 3 To 6
    > If Worksheets("Skew Matrix").Range(Columns(j) & i).Value = "" And CODE
    > Next i
    > Next j
    > End Sub
    > _______________
    > Not working!
    > I was before that writing
    >
    > If Worksheets("Skew Matrix").Range("C" & i).Value = "" And CODE
    >
    > and I do not want to repeat it for every columns...
    > help??
    > many thanks!
    > Daniel



    try to change Range(Columns(j) & i)
    into cells(i,j)
    mcg


  3. #3
    Tom Ogilvy
    Guest

    RE: Mixing For i = x to y and j = z to y for lines and columns

    Sub TEST
    For i = 4 To 32 Step 1
    For j = 3 To 6
    If Worksheets("Skew Matrix").Cells(i,j).Value = "" then

    End if
    Next i
    Next j
    End Sub

    --
    Regards,
    Tom Ogilvy

    "[email protected]" wrote:

    > hello, this morning I have been explained how to use For expression for
    > columns definitions, but I am trying without success to mix it with For
    > expression for lines.
    > Right now code looks like
    > ______________
    > Sub TEST
    > For i = 4 To 32 Step 1
    > For j = 3 To 6
    > If Worksheets("Skew Matrix").Range(Columns(j) & i).Value = "" And CODE
    > Next i
    > Next j
    > End Sub
    > _______________
    > Not working!
    > I was before that writing
    >
    > If Worksheets("Skew Matrix").Range("C" & i).Value = "" And CODE
    >
    > and I do not want to repeat it for every columns...
    > help??
    > many thanks!
    > Daniel
    >
    >


  4. #4

    Re: Mixing For i = x to y and j = z to y for lines and columns

    Many thanks,
    it seems ok, I have a small problem, but I should be able to sort it
    Many thanks, I know understand the logic, what is always greater than
    to find the solution!
    regards
    Daniel
    Tom Ogilvy wrote:
    > Sub TEST
    > For i = 4 To 32 Step 1
    > For j = 3 To 6
    > If Worksheets("Skew Matrix").Cells(i,j).Value = "" then
    >
    > End if
    > Next i
    > Next j
    > End Sub
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    > "[email protected]" wrote:
    >
    > > hello, this morning I have been explained how to use For expression for
    > > columns definitions, but I am trying without success to mix it with For
    > > expression for lines.
    > > Right now code looks like
    > > ______________
    > > Sub TEST
    > > For i = 4 To 32 Step 1
    > > For j = 3 To 6
    > > If Worksheets("Skew Matrix").Range(Columns(j) & i).Value = "" And CODE
    > > Next i
    > > Next j
    > > End Sub
    > > _______________
    > > Not working!
    > > I was before that writing
    > >
    > > If Worksheets("Skew Matrix").Range("C" & i).Value = "" And CODE
    > >
    > > and I do not want to repeat it for every columns...
    > > help??
    > > many thanks!
    > > Daniel
    > >
    > >



+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1