Results 1 to 3 of 3

Assignments to Cells

Threaded View

ffffloyd Assignments to Cells 03-06-2010, 01:03 PM
JBeaucaire Re: Assignments to Cells 03-06-2010, 01:06 PM
ffffloyd Re: Assignments to Cells 03-06-2010, 01:25 PM
  1. #1
    Valued Forum Contributor ffffloyd's Avatar
    Join Date
    05-20-2008
    Location
    Perth, WA, Australia
    MS-Off Ver
    Office 365
    Posts
    249

    Assignments to Cells

    It has been a while since I've used VBA and I'm wondering what I've forgotten.

    If I call a function from Excel with a range of cells, am I able to alter the values of those cells from within the function that I've written?

    Let's say I have the following function:

    Function DoStuff(rng As Range) As String
    It is being called from cell P4 with the range of cells being B2:L9.

    Somewhere in there I have the following piece of code:

    rng.Cells(iRow, jCol).Value = " "
    where iRow = 1 and jCol = 1. I can determine via debug messages that they correctly point to B2 and that prior to this assignment rng.Cells(iRow, jCol).Value = "H".

    However, when I try to step past the above statement in the debugger, it goes to Never Never Land (ie, becomes unresponsive). When I simply execute it from the worksheet without debugging, it returns #VALUE!.

    What obvious error am I making in trying to assign a value? Is there some switch I need to set first so that I can assign values to the passed range? I have tried passing it both ByVal and ByRef.
    Last edited by ffffloyd; 03-06-2010 at 01:27 PM.

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