Compile Error: Invalid Qualifier

billyheanue

Board Regular
Joined
Jul 13, 2015
Messages
109
Code:
Sub CommandButton8_Click()


Dim vlookprint As String
Dim colindexvalyoo As Double
Dim resizevalyoo As Double


resizevalyoo = Sheet1.Cells(19, 12).Value
colindexvalyoo = Sheet1.Cells(16, 12).Value
vlookprint.Resize(resizevalyoo, 1).Formula = "=VLOOKUP(Sheet1!B16,Sheet2!" _     'compile error on vlookprint
    & Sheets("Sheet2").Range("A12").CurrentRegion.Address & ",Sheet1!G$13,FALSE)"
    
End Sub

The contents of the cell storing Vlookprint is: Range("W36")     <-- thats literally what is stored in the cell

Can anybody help out with this!? Im a noob
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Hi Billy,

Code:
Sub DefineEndereco()

Dim rngVlookupPrint As Range


Set rngVlookupPrint = Cells(36, 5)


rngVlookupPrint.Resize(2, 5).Formula = "Vândalo"


End Sub

See if this help you.


Vândalo
 
Upvote 0
.Resize only works on a Range object. vlookprint is a String variable

Try:
Code:
Sub CommandButton8_Click()

Dim vlookprint    as Range
Dim colindexvalyoo  as Double
Dim resizevalyoo     as Double

With Sheet1
    resizevalyoo = .Cells(19,12).Value
    colindexvalyoo = .Cells(16, 12).Value
    Set vlookprint = .Range("W36")
    vlookprint.Resize(resizevalyoo).Formula = "=VLOOKUP(B16,Sheet2!" & Sheets("Sheet2").Range("A12").CurrentRegion.Address & ",G$13,0)"
End With

End Sub
 
Upvote 0

Forum statistics

Threads
1,215,375
Messages
6,124,591
Members
449,174
Latest member
chandan4057

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