+ Reply to Thread
Results 1 to 9 of 9

converting to range datatype

  1. #1
    Registered User
    Join Date
    05-11-2007
    Posts
    93

    converting to range datatype

    How can i convert the following to range type?
    Cells(OldTargetRow, 1) to Cells(OldTargetRow, 50)

    I want to use the WorksheetFunction.CountA .
    Since this function takes range as variable i must somehow convert Cells(OldTargetRow, 1) to Cells(OldTargetRow, 50)
    to range.

    can anyone help me with this?

    Thank you.

  2. #2
    Forum Contributor
    Join Date
    01-10-2006
    Location
    Ahmedabad, India
    MS-Off Ver
    Office 2000
    Posts
    346
    Quote Originally Posted by ballack
    How can i convert the following to range type?
    Cells(OldTargetRow, 1) to Cells(OldTargetRow, 50)

    I want to use the WorksheetFunction.CountA .
    Since this function takes range as variable i must somehow convert Cells(OldTargetRow, 1) to Cells(OldTargetRow, 50)
    to range.

    can anyone help me with this?

    Thank you.
    Please Login or Register  to view this content.
    A V Veerkar

  3. #3
    Registered User
    Join Date
    05-11-2007
    Posts
    93
    When i use

    Range( Cells (OldTargetRow, 1), Cells(OldTargetRow, 50))

    I am getting application-defined or object defined error.

    why is this?

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Please wrap your code or this thread will be deleted

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  5. #5
    Registered User
    Join Date
    05-11-2007
    Posts
    93
    When i use

    Please Login or Register  to view this content.
    I am getting application-defined or object defined error.

    why is this?

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    have you declared OldTargetRow as a variable and determined a value for it?
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  7. #7
    Registered User
    Join Date
    05-11-2007
    Posts
    93
    Yes, i have declared oldTargetRow as a Static variable as follows.

    code:
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    05-11-2007
    Posts
    93
    Sorry,the code is as follows:
    I have declared the oldTargetValue as static variable.

    Please Login or Register  to view this content.

  9. #9
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    You give it a value after you have used it. Try

    Please Login or Register  to view this content.

+ 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