Can't add values to an array

sharky12345

Well-known Member
Joined
Aug 5, 2010
Messages
3,422
Office Version
  1. 2016
Platform
  1. Windows
I'm trying to add values from a row to an array and just can't figure it out.

What I can't work out is how to add the values from column H onward to an array. It's probably very straightforward but I've tried all manner of solutions and just can't get it to work. The latest thing I have tried is producing an array but it has extra blank values added too.

This is what I've been playing with, (don't make fun at how rough and crude it is, I'm doing my best to tinker and learn!).

VBA Code:
LastRow = ThisWorkbook.Worksheets("COPYRESULTS").Range("A65536").End(xlUp).Row

For Each Cell In ThisWorkbook.Worksheets("COPYRESULTS").Range("A2:A" & LastRow)

r = Cell.Row

ColNo = Cells(r, Columns.Count).End(xlToLeft).Column
ColLe = Col_Letter(Cells(r, Columns.Count).End(xlToLeft).Column)

Dim myary(1 To 7) As String
Dim var As Integer
Dim myrang As Range, myC As Range
var = 1
Set myrang = Range("H3:" & ColLe & "3")
For Each myC In myrang
myary(var) = "• " & myC.Value
var = var + 1
Next myC
For var = LBound(myary) To UBound(myary)
Debug.Print myary(var)
Next var

Next Cell

Any advice is appreciated!
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
A colleague @Alex Blakenburg has pointed out that the issue could have been caused by a misalignment of the code with the actual data. Could you just check that the Summary column is column G, and that your data starts in row 2 with headers in row 1?
 
Upvote 0
Morning :)

I have no idea what I did yesterday because when I ran it this morning it works fine, so I'm sorry for the confusion but thank you so much for solving it for me!
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,169
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top