Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
sunny_talwar

Macro for Border (Part 2)

Thanks to tamilarasu‌ and marcus_sommer‌ I was able to get the first part of the issue under my belt Macro for Border. Now, the next part is to assign this code to a cell which corresponds to a particular value in another cell. For example

Header 1Header 2
XYZ10
ABC20
Total30

Now the idea is to apply the border to the cell where Header 1 = 'Total'

1 Solution

Accepted Solutions
sunny_talwar
Author

Got it working using this:

Set Rng = XLSheet.Cells.Find("Total").Offset(0, 2)

View solution in original post

2 Replies
sunny_talwar
Author

Got it working using this:

Set Rng = XLSheet.Cells.Find("Total").Offset(0, 2)

marcus_sommer

Hi Sunny,

one possibility is to query which of your cells contained the value 'Total' within a loop maybe in this way:

for i = 1 to EndOfYourRows

     if XLSheet.Range("B" & i).Value = 'Total' then

          Set Rng = XLSheet.Range("C" & i).Select

          ....

     end if

next

whereby EndOfYourRows could be generated through something like "UsedRange.Columns.Count". It will be depend on your concrete case which method will be needed for it. An alternative could be to count the number of rows before in qlik within a variable like: count(Dim1&Dim2&Dim3) - which meant you could avoid the loop and address the cells directly.

- Marcus