Results 1 to 10 of 10

Thread: Telling VBA to find a cell, row, column, range

Hybrid View

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2005
    Posts
    31

    Re: Telling VBA to find a cell, row, column, range

    Oh, I didn't know that... thanks...

    Type mismatch is in row 2, 7,10...
    Also row 2,3,7,8 when I dubug and move mouse over them the values show "Nothing" or ""

    Thanks,

    John

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Telling VBA to find a cell, row, column, range

    Ok, where are the variables defined?

    It looks like rRow needs to be dimmed as a Range since you are setting it to a range.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jan 2005
    Posts
    31

    Re: Telling VBA to find a cell, row, column, range

    I am trying to hard code it in a little... however I am having problems with my select case down there in the code... I need that 10 to be static... cause i have Columns 10, 12, 14,... 22 to test against. should the 10 go on the other side of the "=" or how should I refer to it...

    2ndly is "oMarketSheet.Columns(rCount, ColAccntE)" syntaxed properly?

    Thanks much...

    John

    VB Code:
    1. Dim rCount As Integer
    2.   Dim ColDate As Integer
    3.   Dim ColAccntB As Integer
    4.   Dim ColAccntE As Integer
    5.   Dim ColRev As Integer
    6.    
    7.   rCount = 11
    8.   ColDate = 2
    9.   ColAccntB = 10
    10.   ColAccntE = 22
    11.   ColRev = 11
    12.    
    13. 'For oMarketSheet.Rows(rCount,) To oMarketSheet.Columns(ColDate)
    14. Do While rCount <= 42
    15.  
    16.      If IsDate(oMarketSheet.Cells(rCount, ColDate)) Then
    17.           Do While ColAccntE < 23  'sCol = oMarketSheet.Rows(rCount, ColAcccntB)  oMarketSheet.Columns(rCount, ColAccntE) ' ColAccnt)
    18.           iDate = oMarketSheet.Cells(rCount, ColDate)
    19.                  Select Case Accnt
    20.                         Case oMarketSheet.Columns(rCount, "10") = oMarketSheet.Columns(rCount, ColAccntB) ' = j
    21.                              Accnt = "010-41200"

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Telling VBA to find a cell, row, column, range

    Depending on how you have your column formatted (Date, Number, or Text) this will probably help.
    VB Code:
    1. Dim rCount As Range
    2.   Dim ColDate As Date
    3.   Dim ColAccntB As Integer
    4.   Dim ColAccntE As Integer
    5.   Dim ColRev As Integer
    6.   Dim Accnt As String
    7.   Dim rRow As Range
    8.   Dim rCell As Cell
    We need to tackle the errors one at a time. Get those working then we can
    move on to any others.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Jan 2005
    Posts
    31

    Re: Telling VBA to find a cell, row, column, range

    This user type has to be defined for the Cell and Range... how do I do that?

    VB Code:
    1. Dim rCell As Cell
    2. Dim rCount As Range
    Last edited by opie_18; Feb 7th, 2005 at 02:00 PM.

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Telling VBA to find a cell, row, column, range

    Are you writting the code in the VBA Editor (behind Excel) or from Visual Basic?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Jan 2005
    Posts
    31

    Resolved Re: Telling VBA to find a cell, row, column, range

    got it...

    Thanks

Posting Permissions

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



Click Here to Expand Forum to Full Width