Write Range excel with Counter


#1

Hi All,

I’m wondering why when i’m using counter for write excel it will always end up 10 row below
for example
i’m assign Counter = Counter + 1
after that im using
“B”+Counter.ToString in the write range and will write at b1
3
but if im using “B1”+Counter.ToString, it will write at column 11
4
also if im using “B1”+Counter.ToString, it will write at column 21
5

How this is happen? Is my logic incorrect?

Thanks as always.

Regards

Delf


#2

@delf
use “B”+counter.tostring


#3

Hi @pathrudu

Sorry i dont inform you about my problem.
The problem is i want write in B2 because B1 is used for Header in excel.
then if im using “B2”+Counter.ToString it will write at column 21.

That’s the gist of it. Thanks for your help

Regards

Delf


#4

Hey @delf,

Apologize if i am not clear.

I believe you want to write your data starting from B2, B3…and so on. If yes in that case you should use “B”+Counter.ToString, however your counter should from 1(instead of 0) to skip the 1st row.

In your case, Since “B2” is a string and Counter.ToString will also have a string, the output value of this would be B21. Hence that issue.

Let me know if that’s not what your are looking for.

Thanks,
Rammohan B.


#5

Hi @Rammohan91

Your solution works fine and yes that’s what i’'m looking for. Thanks a lot :smiley:

Regards

Delf


#6

Great @delf Happy to help :slight_smile:

Thanks
Rammohan B.