DrParmeJohnson
New Member
- Joined
- Feb 28, 2019
- Messages
- 44
Hello,
I am trying to make my macro take a set of selected cells and assign those cells as a range to a variable, excluding the header. The macro is a WIP and so this is aimed to help build the next step of the macro. The next step would be to take that range, use it to find how long the column is and then use that length to loop through each cell of the column and do something else. Also, the commented bits can be ignored as they are just placeholder at the moment. But anyways, here is what I have thus far:
I am trying to make my macro take a set of selected cells and assign those cells as a range to a variable, excluding the header. The macro is a WIP and so this is aimed to help build the next step of the macro. The next step would be to take that range, use it to find how long the column is and then use that length to loop through each cell of the column and do something else. Also, the commented bits can be ignored as they are just placeholder at the moment. But anyways, here is what I have thus far:
Code:
Sub LD_ASIN()
'
' LD_ASIN Macro
'
'ActiveWorkbook.SaveAs ("C:\Users\Alek Pruszynski\Documents\Amazon Documents\Amazon Sheet - " _
& Format(Now(), "DD-MM-YYYY") & ".xlsm")
'Dim amznnum As String
'Dim itemnum As String
Dim i As Integer
Dim cell As Variant
Dim length As Integer
Dim myRange As Range
Dim rngASIN As Range
Set rngASIN = Range("A1:Z1").Find("ASIN")
If rngASIN Is Nothing Then
MsgBox "ASIN column was not found."
Exit Sub
End If
Columns.Range(rngASIN, rngASIN.End(xlDown)).Select
If TypeName(Selection) = "Range" Then
Set myRange = Selection
Else
Exit Sub
End If
For Each cell In myRange
If cell.Value = "<>" Then
length = length + 1
End If
Next
MsgBox length
'length =
'For i = 1 To Columns.Count
' Application.CountA(Columns(rngASIN)) = length
' length = Range(rngASIN, rngASIN.End(xlDown)).Count
'Next
' For i = 1 To length
' Application.Index(Application.VLookup( ) , Range("2:5000")) =
'
End Sub