Friday 23 September 2016

counter in vba [Anwsered]

counter in vba

hi,
 
In a macro I have various string with : "counter ..." but I don't understad if it's only a value or something else, someone can explane me?
thanks
here the example:
 
counter = 0
   
    For i = 1 To Sheets("main (2)").Range("A6").CurrentRegion.Rows.Count
      Sheets("main (2)").Select
      Range("A5").Offset(i, 0).Select
      deptno = ActiveCell.Offset(0, 0).FormulaR1C1
      acctno = ActiveCell.Offset(0, 2).FormulaR1C1
      intercompanyno = ActiveCell.Offset(0, 4).FormulaR1C1
      projectnumber = ActiveCell.Offset(0, 5).FormulaR1C1
      Comments = ActiveCell.Offset(0, 7).FormulaR1C1
      ColumnCount = Range("A1").CurrentRegion.Columns.Count - 9
      For j = 1 To ColumnCount
        Sheets("main (2)").Select
        amount = Range("A5").Offset(i, j + 9).FormulaR1C1
        If amount <> "" Then
            Sheets("source_file").Select
            Range("A1").Offset(counter, 0).Select
            ActiveCell.Offset(0, 0).NumberFormat = "@"
            ActiveCell.Offset(0, 10) = Comments
            counter = counter + 1
         End If
      Next j
       Sheets("Source_file").Columns.EntireColumn.AutoFit
       Sheets("Source_file").Columns.HorizontalAlignment = xlCenter
    Next i

Solutions to the Problem counter in vba

Download SmartPCFixer to Fix It (Free)

thanks for your reply,
but i don't understand one thing, if I write counter = 0 is the same thing as write for example i = 1 ??
thanks
Hi,
Yes it's exactly the same.
In your snippet of code, counter is what's called a variable.
Whoever wrote the code set it's value to zero and then the value changed as the code ran.

To check for Windows updates. Open Windows Update by clicking the Start button , clicking All Programs, and then clicking Windows Update. In the left pane, click Check for updates, and then wait while Windows looks for the latest updates for your computer. If any updates are found, click Install updates.

Install the latest updates for Windows and for the program displaying the error. Note that the update for the program might be listed as an optional update on the Windows Update page.

Open Windows Update by clicking the Start button Picture of the Start button. In the search box, type Update, and then, in the list of results, click Windows Update.

Another Safe way to Fix the Problem: counter in vba:

How to Fix counter in vba with SmartPCFixer?

1. You can Download Error Fixer here. Install it on your computer. When you open it, it will perform a scan.

2. After the scan is finished, you can see the errors and problems which need to be repaired.

3. The Fixing part is finished, the speed of your computer will be much higher than before and the errors have been removed.


Related: How Can You Update & Download NVidia 6100, 6800 GS/XT Display Driver v.260.89 WHQL,Where to Download NVidia GeForce 8800 GT WHQL-certified driver v.196.21,How to Update & Download NVidia GeForce Go 7400 Display Driver v.260.19.12,[Solved] Download NVidia GeForce GTX 460M Driver v.331.82,Download NVidia Quadro Plex Model IV VGA Driver v.304.43 Certified,Way to Download RealTek RTL8100C(L) Driver v.5.01,Way to Download RealTek RTL8100E Drivers v.694,Way to Update & Download RealTek RTL8101L Auto Installation Program v.6.110 driver,Method to Update & Download RealTek RTL8111G PXE and RPL ROM code v.2.58 driver,How to Update & Download RealTek RTL8411B(N) Driver v.10.003,Best Way to Update & Download ASUS A53SV nVidia Graphics Driver v.8.17.12.6686,Method to Herunterladen ASUS K75VJ Intel Rapid Storage Technology Treiber v.11.6.0.1030,How Can You Update & Download ASUS CG8580 Intel Chipset Driver v.9.3.0.1019,Method to Update & Download ASUS K41VD Intel INF Update Driver v.9.1.1.1015,Way to Update & Download ASUS Pro70T NB Probe v.3.0.0026 driver
Read More: Troubleshooter of Error: Continuous beep during start up,showing edit boot options...,How to Fix - Convert Dynamic Disk to Basic?,How to Fix - Constant problem with "Communication not Available" ; Vista 64 bit / Lexmark x9350?,How to Resolve - copy R1C1 formula in same cell of multiple sheet?,How to Fix Error - corrupt fils in digital managmet files for windows medial player?,Closing Internet Explorer causes error,Compare 2 Tables and Calculate the PROFIT Faster,Computer goes to Windows Boot Manager after Start,Connect to one of my network computer remotely when don't allow exception box Marked,computer locking up randomly

No comments:

Post a Comment