Posts by kel.ley

    hi everybody,

    i have a code using worksheet_selectionchange to detect if a change has been made within a defined range.

    i have a module with the following code to first define the range:

    next is the code to detect the if the change occurs with in the defined range. this code is within Sheet(1).

    when i click play by itself, define_ranges work. i tested it by adding code to select Rprecomm and the correct range of cells are selected. when i click outside Columns("B:C"), the code executes correctly, which is to exit.

    however, when i click within Columns("B:C"), it goes into debug mode and sub findcell is highlighted. also, when i go back into the excel sheet, i cannot click anything as the cell being selected is stuck at A1.

    1)is the error with the declaration of Public Rprecomm or sub findcell? i use sub findcell for my other codes and it works fine.

    2) another minor thing is that i want to execute selectionchange only after i input something, not when i click on a cell. how should i modify the code to reflect this?

    thanks for the help!

    Re: run-time error '91': object variable or with block variable not set

    hi everyone!

    thanks for the help thus far. i've figured out the problem already.

    i was writing this piece of code in my friend's Sheet and did not know that he defined some variables under General. somehow they clashed with my portion of the code.

    just a question:

    if i used private Sub instead of Sub, will the code still have run time error if a variable (e.g. x) is declared both in General (e.g. as string) and in the private Sub(e.g. as Integer)?

    hi everyone,

    i'm new to excel vba and even newer to this forum so i'll appreciate any help to guide me along!

    i have a code to do the following steps:
    1) find a cell in Sheets("Phases")
    2) Reference a cell relative to it
    3) Use the fill colour (is interior.colourindex correct?) of this reference cell as a basis for comparison
    4) Move the selected cell down if the colour is the same as the reference colour

    1) currently i have a run time error. it seems that the error is at the cells.find part when i debug it. what should i do?

    2) is my code correct to compare the fill colour of a cell and then set it as a basis of comparison?

    3) also, i have another sub (not shown here) which also has "dim target as Range". is it possible to reuse the same word? or is that the cause of the error in the first place?

    *thanks to wigi for putting in code tags