SOLVED

Can anyone see the error in this VBA code?

Copper Contributor

Hello All,

 

I am very new to vba code. I am learning mainly by adapting existing macros.

 

On the screenshot here, you can see a line of code that isn't working.

 

nicholasajl_0-1590917677504.png

This code, as a whole, creates a new sheet for each row of data.

I want to create a sparkline in cell A20. The problem is how to sourcedata range. It is always columns BK to CW, but I need to tell it how to use just one row. 

 

The &Rng.Row operation works on all other lines, but not here.

 

Can anyone help?

 

Thanks,

 

Nick

 

3 Replies
best response confirmed by nicholasajl (Copper Contributor)
Solution

@nicholasajl 

 

Hi,

 

Currently you are supplying a row reference to only the CW column of MasterSheet!BK:CW, but the BK column also requires a row reference:

 

"MasterSheet!BK" & Rng.Row & ":CW" & Rng.Row

 

Regards

@Jos_Woolley 

 

In minutes, you've fixed what I've spent many hours trying to sort.

 

I'm so grateful!

 

Many thanks,

 

Nick :)

@nicholasajl 

 

You're very welcome! You're doing the right thing by trying to adapt code yourself in order to develop your understanding of VBA. Best way to learn, in my opinion.

 

Regards

1 best response

Accepted Solutions
best response confirmed by nicholasajl (Copper Contributor)
Solution

@nicholasajl 

 

Hi,

 

Currently you are supplying a row reference to only the CW column of MasterSheet!BK:CW, but the BK column also requires a row reference:

 

"MasterSheet!BK" & Rng.Row & ":CW" & Rng.Row

 

Regards

View solution in original post