Posts by gillrajb

    This seems like something that would not be very difficult, but i have no idea how to do it. I would like to get the cell address of a changing value in a reference table. Or even the row of a value that occurs somewhere in a table. Anyone?

    Re: Empty Cell Is Treated Like 0


    for some reason when I put in your code im getting a mismatch error on the earlier line that reads:


    Code
    directory2(direc2count, 0) = ActiveCell.Offset(j, -1).Value
    directory2(direc2count, 2) = ActiveCell.Offset(j, 25).Value ' the error points to this line
    direc2count = direc2count + 1
    
    
    If CStr(ActiveCell.Offset(j, 0).Value) = CStr(directory1(2, 90)) Then
    MsgBox "why"
    End If

    for some reason when Im creating a empty loop to go down a range of cells and check if that value = the value in a array. However even on the empty cells it treats it like it means 0.


    Code
    If ActiveCell.Offset(j, 0).Value = directory1(2, 90) Then
    MsgBox "why"
    End If


    with this code, i get a msg even though the cell is empty, but the integer directory1 array is 0 . Should I run a loop and fill directory1 with a different number?

    Is there a way to easily set a already declared integer array as one value? Because when I declare a integer array the array has empty values and not 0 so when I go down a range it treats a empty range as a value in the array. So I thought I should just set everything to 0 before I work with it. Also, I want to know the number of columns in a array how do i do that?

    Re: Search In Large Array For Value


    For some reason I am getting an error when I try to create a simple function that uses a matrix and a variable
    ' this is cut off code:

    Re: Search In Large Array For Value


    the values in the array are values I have added. I was wondering, how do I get the ubound of the rows on a ie 600x456 matrix? Whenever I use ex ubound(records) I get 9, which is the number of rows. How do I get the number of columns?

    Hi again, I am trying to find the easiest way to repeatedly search a large matrix (300,400) for a particular value. I have used two for loops in the past but its starting to get complicated now. Is there a workaround using application.worksheets.something that I could get a true of false reply? Someone may suggest that I create a function that replys back. I am new to VB and I am not sure how to send a matrix of integers to a function (syntax). Appreciate it



    rj

    Re: Workbooks Count


    The script is actually working now, but for some reason there is a certain order when it wont. Also, is there a way I can get it to update when you select a cell AND also when the sheet is activated? Basically so it will update in real time.

    I have a script running on a worksheet that checks that a name of a workbook is open or not
    What happens is, it doesn't recognize that the workbook is open even when it is. When there are 2 workbooks and i msgbox workbooks(2).name, it gives me an error.


    whats up?

    Hi, I was wondering, I would like to create a go back button from one sheet to another in a workbook. I am assuming that the code will go into each sheet. I would like the user to be able to select a macro and they will go back to the last sheet visited.


    How would I do this.



    thx

    Re: Macros Cause Closed Files To Open


    nvm i got it, it was because I had made both files initiate macros on the right click, and this was done in Auto_open. Therefore teh second file opened would always require teh macros and thus when it was closed and the right click was clicked, it would require teh old file and open it.

    To test this situation I made a copy of a 'File1' and saved it as 'File2', where File1 had many macros that ran within the file (none required the use of any other files). The problem comes when I open File1 and File2 and then close File2.
    Then when I try to run a macro in File1 it just opens File2 even though I did not copy anything from File2 into File1 or make any changes whatsoever.


    This was an experiment I tried to do to narrow the problem, as of now I know its not because of copied text. This problem arrived when I tried to copy information from a different file into 'File1' and when I closed the other file, and tried to run a macro in File1, it would open the old file I copied from.


    Also, I found that to fix this problem I had to close both files and reopen them. However the macro file is quite large and takes time to save changes in and it can get frustrating when you are required to close everything after a simple copy and paste operation, just to get it to work.


    Can someone help me with this as it is crucial to the project im working on.


    Thanks