I am designing a from to create a graph based on data which is pasted into a specific sheet in a workbook. The form has two cells which has the letter reference for the data source for a graph.
In my code, I am attempting to convert the letter stored as a string into a range. The code has an error at line:
Nalastrow = Sheets("Datadrop").Range(" & Na & 65536 ").End(xlUp).Row
Can anyone assist with the correct syntax for converting strings to ranges?
In my code, I am attempting to convert the letter stored as a string into a range. The code has an error at line:
Nalastrow = Sheets("Datadrop").Range(" & Na & 65536 ").End(xlUp).Row
Can anyone assist with the correct syntax for converting strings to ranges?
Code:
Sub Chartgraph()
Dim Na As String
Dim Ca As String
Dim Nalastrow As Long
Dim Calastrow As Long
Dim Nar As Range
Dim Car As Range
Na = Application.WorksheetFunction.Trim(Sheets("Key Stats").Range("B8").Value) 'cell with column reference
Ca = Application.WorksheetFunction.Trim(Sheets("Key Stats").Range("B9").Value) 'cell with column reference
Nalastrow = Sheets("Datadrop").Range(" & Na & 65536 ").End(xlUp).Row
Calastrow = Sheets("Datadrop").Range(" & Ca & 65536 ").End(xlUp).Row
Na = Na & 2
Ca = Ca & 2
Set Nar = Sheets("Datadrop").Range(" & Na & : & Na & Nalastrow")
Set Car = Sheets("Datadrop").Range(" & Ca & : & Ca & Calastrow")
[CODE\]