excel vba - compile error called subscript out of Range -
I have many columns, please provide me a range, please help me, I am adding columns to my database
aWidth = WorksheetFunction.CountA (Range ("A1: FA1")) 'Finds the width of the table - If you have more columns than that, then simply expand the category AHeight = WorksheetFunction.CountA (range ("A1: A65536") - 1 'height of the table, reduces area names - If you have more lines than it, then just limit Expand = 0 'will be used in the entire macro as counter count_2 = 0' will be used during the macro as a counter count_3 = 0 'will be used in the entire macro as a counter ---- --------------------------------------------------- ----------------------- - 'Table row to population' -------------------- --------------------------------------------------- -------- Redeem array_field (avid) 'This value will come in values that will go to the total upload for count = avid Count = set count + 1 "in the count to be used in the array and it is increasing to the dot cell = Worksheets (" upload "). Room (1, count). Value array_fields (count) = cell loop
It is not clear to me that what you But I think the macros given below will help you set it in the right direction.
Create a new workbook, open VBA Editor, create a module and copy the macro into the module below.
Copy = "R" and ROW (A1) & amp; "- C" & amp; This formula is not required in cell A1 of COLUMN (A1) worksheet sheet1 but this effect will show that I want to display very clearly. Copy the cell A1 and then copy the line 1 to a small rectangle (say 5 * 10).
Run the macro.
The statement uses the cellValue = .UsedRange.Value worksheet to import "Sheet 1" as an array and stores it in the variant Cell value . With two-dimensional arrays, the conference should have columns as rows in the form of first dimension and second dimension. The arrays that fill the loading of a range are the second round.
statement cellvalue = worksheet function. The transfer (.us .zange range. Value) also imports range but swap line and column. If you want to copy one line of values to a one-dimensional array before writing 1-D array in your database, the transfer will be of small value. However, if you can write a two-dimensional array, you can get the data in format for only one format.
Option Clear sub demo () Dim CellValue Variient Slight Calculant Worksheet ("Sheet 1") CellValue = As Long Retardant = Debug Ubound (cellValue, 1) for ColCrnt = 1 for Ubound (CellValue, 2) for RowCrnt = 1. Print "|" & Amp; Selvueu (Cocktail, Row Krant); Next debug Print "|" Next debug Print ("-----------------------------------------") Cell Value = WorksheetFunction .transpose (.UsedRange.Value) for Ubound for RowCrnt = 1 (CellValue, 2) UBound (cellValue, 1) debug for ColCrnt = 1. Print "|" & Amp; Selvueu (Cocktail, Row Krant); Next debug Print "|" Next end with the ending
Comments
Post a Comment