+ Reply to Thread
Results 1 to 6 of 6

Why type mismatch - R/T error 13

  1. #1
    Jim May
    Guest

    Why type mismatch - R/T error 13

    I was/am trying to assist a previous OP (you'll possibly see it below) -
    anyhow
    my code at present is bombing at the last line presented below:
    Any assistance appreciated..

    Sub Tester()
    Dim CurrDate As Date
    Dim Nxtrow As Long
    Dim TargRange As Range
    CurrDate = Sheets("CallerInput").Range("B29")
    Set TargRange = Worksheets("Infoloader").UsedRange.Columns(1)
    For Each c In TargRange
    If c.Value = CurrDate Then <<<<<<<<< Bomb !!



  2. #2
    Dave Peterson
    Guest

    Re: Why type mismatch - R/T error 13

    Try being more explicit:

    For Each c In TargRange
    becomes
    For Each c In TargRange.Cells

    And .usedrange.columns(1) may be column A. I think the OP wants to check column
    B.

    (And don't forget to "dim C as range" <vbg>.)

    Jim May wrote:
    >
    > I was/am trying to assist a previous OP (you'll possibly see it below) -
    > anyhow
    > my code at present is bombing at the last line presented below:
    > Any assistance appreciated..
    >
    > Sub Tester()
    > Dim CurrDate As Date
    > Dim Nxtrow As Long
    > Dim TargRange As Range
    > CurrDate = Sheets("CallerInput").Range("B29")
    > Set TargRange = Worksheets("Infoloader").UsedRange.Columns(1)
    > For Each c In TargRange
    > If c.Value = CurrDate Then <<<<<<<<< Bomb !!


    --

    Dave Peterson

  3. #3
    Dave Peterson
    Guest

    Re: Why type mismatch - R/T error 13

    ps. before you do that change, try adding
    msgbox c.address

    and you'll see why it blows up. Trying not to give it away. That type of range
    doesn't have a .value.

    Dave Peterson wrote:
    >
    > Try being more explicit:
    >
    > For Each c In TargRange
    > becomes
    > For Each c In TargRange.Cells
    >
    > And .usedrange.columns(1) may be column A. I think the OP wants to check column
    > B.
    >
    > (And don't forget to "dim C as range" <vbg>.)
    >
    > Jim May wrote:
    > >
    > > I was/am trying to assist a previous OP (you'll possibly see it below) -
    > > anyhow
    > > my code at present is bombing at the last line presented below:
    > > Any assistance appreciated..
    > >
    > > Sub Tester()
    > > Dim CurrDate As Date
    > > Dim Nxtrow As Long
    > > Dim TargRange As Range
    > > CurrDate = Sheets("CallerInput").Range("B29")
    > > Set TargRange = Worksheets("Infoloader").UsedRange.Columns(1)
    > > For Each c In TargRange
    > > If c.Value = CurrDate Then <<<<<<<<< Bomb !!

    >
    > --
    >
    > Dave Peterson


    --

    Dave Peterson

  4. #4
    Jim May
    Guest

    Re: Why type mismatch - R/T error 13

    Thanks Dave for the help.
    Before your ps note (below) I had already modified code so unable to try
    "msgbox c.address" suggestion. Now realize how any "For each" needs
    ".cells" on end of a set rng. I'm getting there - thanks to guys like
    you...
    Jim May

    "Dave Peterson" <[email protected]> wrote in message
    news:[email protected]...
    > ps. before you do that change, try adding
    > msgbox c.address
    >
    > and you'll see why it blows up. Trying not to give it away. That type of

    range
    > doesn't have a .value.
    >
    > Dave Peterson wrote:
    > >
    > > Try being more explicit:
    > >
    > > For Each c In TargRange
    > > becomes
    > > For Each c In TargRange.Cells
    > >
    > > And .usedrange.columns(1) may be column A. I think the OP wants to

    check column
    > > B.
    > >
    > > (And don't forget to "dim C as range" <vbg>.)
    > >
    > > Jim May wrote:
    > > >
    > > > I was/am trying to assist a previous OP (you'll possibly see it

    below) -
    > > > anyhow
    > > > my code at present is bombing at the last line presented below:
    > > > Any assistance appreciated..
    > > >
    > > > Sub Tester()
    > > > Dim CurrDate As Date
    > > > Dim Nxtrow As Long
    > > > Dim TargRange As Range
    > > > CurrDate = Sheets("CallerInput").Range("B29")
    > > > Set TargRange = Worksheets("Infoloader").UsedRange.Columns(1)
    > > > For Each c In TargRange
    > > > If c.Value = CurrDate Then <<<<<<<<< Bomb !!

    > >
    > > --
    > >
    > > Dave Peterson

    >
    > --
    >
    > Dave Peterson




  5. #5
    Dave Peterson
    Guest

    Re: Why type mismatch - R/T error 13

    It doesn't always need it. But if you want to cycle through the cells, it never
    huts to add it.

    On the other hand, if you want to cycle through colums/rows, you can .columns or
    ..rows at the end.



    Jim May wrote:
    >
    > Thanks Dave for the help.
    > Before your ps note (below) I had already modified code so unable to try
    > "msgbox c.address" suggestion. Now realize how any "For each" needs
    > ".cells" on end of a set rng. I'm getting there - thanks to guys like
    > you...
    > Jim May
    >
    > "Dave Peterson" <[email protected]> wrote in message
    > news:[email protected]...
    > > ps. before you do that change, try adding
    > > msgbox c.address
    > >
    > > and you'll see why it blows up. Trying not to give it away. That type of

    > range
    > > doesn't have a .value.
    > >
    > > Dave Peterson wrote:
    > > >
    > > > Try being more explicit:
    > > >
    > > > For Each c In TargRange
    > > > becomes
    > > > For Each c In TargRange.Cells
    > > >
    > > > And .usedrange.columns(1) may be column A. I think the OP wants to

    > check column
    > > > B.
    > > >
    > > > (And don't forget to "dim C as range" <vbg>.)
    > > >
    > > > Jim May wrote:
    > > > >
    > > > > I was/am trying to assist a previous OP (you'll possibly see it

    > below) -
    > > > > anyhow
    > > > > my code at present is bombing at the last line presented below:
    > > > > Any assistance appreciated..
    > > > >
    > > > > Sub Tester()
    > > > > Dim CurrDate As Date
    > > > > Dim Nxtrow As Long
    > > > > Dim TargRange As Range
    > > > > CurrDate = Sheets("CallerInput").Range("B29")
    > > > > Set TargRange = Worksheets("Infoloader").UsedRange.Columns(1)
    > > > > For Each c In TargRange
    > > > > If c.Value = CurrDate Then <<<<<<<<< Bomb !!
    > > >
    > > > --
    > > >
    > > > Dave Peterson

    > >
    > > --
    > >
    > > Dave Peterson


    --

    Dave Peterson

  6. #6
    Jim May
    Guest

    Re: Why type mismatch - R/T error 13

    Dave thanks you for the response; I actually understood what
    you were saying as I read your words << this is a rarity - for me.
    appreciate you,
    Jim

    As i read your
    "Dave Peterson" <[email protected]> wrote in message
    news:[email protected]...
    > It doesn't always need it. But if you want to cycle through the cells, it

    never
    > huts to add it.
    >
    > On the other hand, if you want to cycle through colums/rows, you can

    ..columns or
    > .rows at the end.
    >
    >
    >
    > Jim May wrote:
    > >
    > > Thanks Dave for the help.
    > > Before your ps note (below) I had already modified code so unable to try
    > > "msgbox c.address" suggestion. Now realize how any "For each" needs
    > > ".cells" on end of a set rng. I'm getting there - thanks to guys like
    > > you...
    > > Jim May
    > >
    > > "Dave Peterson" <[email protected]> wrote in message
    > > news:[email protected]...
    > > > ps. before you do that change, try adding
    > > > msgbox c.address
    > > >
    > > > and you'll see why it blows up. Trying not to give it away. That

    type of
    > > range
    > > > doesn't have a .value.
    > > >
    > > > Dave Peterson wrote:
    > > > >
    > > > > Try being more explicit:
    > > > >
    > > > > For Each c In TargRange
    > > > > becomes
    > > > > For Each c In TargRange.Cells
    > > > >
    > > > > And .usedrange.columns(1) may be column A. I think the OP wants to

    > > check column
    > > > > B.
    > > > >
    > > > > (And don't forget to "dim C as range" <vbg>.)
    > > > >
    > > > > Jim May wrote:
    > > > > >
    > > > > > I was/am trying to assist a previous OP (you'll possibly see it

    > > below) -
    > > > > > anyhow
    > > > > > my code at present is bombing at the last line presented below:
    > > > > > Any assistance appreciated..
    > > > > >
    > > > > > Sub Tester()
    > > > > > Dim CurrDate As Date
    > > > > > Dim Nxtrow As Long
    > > > > > Dim TargRange As Range
    > > > > > CurrDate = Sheets("CallerInput").Range("B29")
    > > > > > Set TargRange = Worksheets("Infoloader").UsedRange.Columns(1)
    > > > > > For Each c In TargRange
    > > > > > If c.Value = CurrDate Then <<<<<<<<< Bomb !!
    > > > >
    > > > > --
    > > > >
    > > > > Dave Peterson
    > > >
    > > > --
    > > >
    > > > Dave Peterson

    >
    > --
    >
    > Dave Peterson




+ 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