Update values for visible rows

  • Hello I have a really simple problem. I know what is wrong, but dont know how to fix it. What I am doing is running a macro on all visible cells. The problem is that it does not really run in the range I want it to, but for the active cell only. Any idea why? I really need to get this to work.


  • Re: Update values for visible rows


    Works fine for me, except for that 'IskanjeNapak.IskanjeNapak'


    It loops down from A2 to to the row specified in Cell(2,2) setting values to blank and interior colour...

  • Re: Update values for visible rows


    That part also works fine for me. It clears all cells, but IskanjeNapak.IskanjeNapak only activates for the cell i have selected. Do you suspect the error has to be in the IskanjeNapak.IskanjeNapak then? I will have to remake that part for this macro then.

  • Re: Update values for visible rows


    Not being an expert in Slovak (I presume), I had no idea what that even means. Obviously, now I realise it's a call to another procedure - do you not think it would be sensible to post the code for that procedure?

  • Re: Update values for visible rows


    Close enough :D It is Slovenian language. It calls another macro. This macro runs a procedure for every row on first sheet. This procedure then checks for mistakes on another sheet, and marks cells in the first sheet. I will post that code (translated) in the next half and hour. It seems i will have to join these 2 macros, and this will also skip the double clearing of some cells.

  • Re: Update values for visible rows


    Thx again for all the help. Really appreciate it. Because I will use many different filters, and I have to make this code work, so I can use it for each of them.
    This is the code I translated. I hope you can figure out something from it. If you have any questions about what a certain part does I will gladly explain. And also if you have any suggestions how to improve it, I will also be happy about it. This is a kinda hard project for me, because this is my first project in VBA, and I havent had much experience in programming before either. And I have to get rid of this stupid habit to code a bit in english and a bit in our language :D.


  • Re: Update values for visible rows


    Unfortunately it still can't be tested. You have a call to a procedure called 'Klic' which populates a worksheet and you then process that worksheet. Would be best if you uploaded an anonymised (any personal/corporate identifying information changed to something fictional) workbook.


    The one thing that stands out is your use of GoTo. These really should be replaced by other control structures. for example:


    This can be replaced by

  • Re: Update values for visible rows


    Thx, didnt know about exit for. I will use it from now on. Even if I make a fictional file, it will not work if I post it to you, because the procedure "klic" gets some data from the server and fills in sheet "DN". I will do my best to make a dummy file, but it will take me some time. I will change the file, so it will not actually call klic, but only go to sheet "DN". I will post the dummy file in the next few hours. Thx again for all your help.

  • Re: Update values for visible rows


    ozgrid.com/forum/core/index.php?attachment/45716/
    This is the dummy file i crated. Because the "klic" procedure would not work, i just made up some data on sheet "DN" that we can pretend we get after calling that procedure. The macro i want to get to work is on the userform "Update", and is activated with clicking the button "Visible Rows". The translated code is available in module "Test". I hope this makes things clearer.

    Files

    • DummyFile.xls

      (91.65 kB, downloaded 65 times, last: )
    • DummyFile2.xls

      (95.74 kB, downloaded 70 times, last: )
  • Re: Update values for visible rows


    I managed to figure it out. I was addressing different rows on the two macros. The one that was called by the main macro was calling active row, and because of that the rows never changed. After i fixed that i had a minor glich with some colorings, because i used the variable j for different things in the two macros, but after i fixed that, the program works perfectly. Thx again for all your help.