Delete Range is also deleting my header

Hello,

I’m using the activity delete range to delete existing data on a tab that I’m pasting new data to. Everytime I run the automation, it deletes my headers as well even though my headers are on row 2 and I’m deleting data starting at row 3. I’m sure it’s something simple, but I’m not sure how to fix this problem.

Hi,

For now, can you check content of FYrowcount variable? if it’s 2 or 1, it causes deleting header.

Regards,

Hi @jenn.cruz

Your row count variable value should be incremented by 2 as the row number starts from 0 whereas in excel it starts from 1.

Check on the row count value and increment it according to your requirement.

Hope it helps!

Cheers

This is what’s inside the variable.

This is my row count variable.

Hi @jenn.cruz

Whats the value you are getting in the variable ? can you print or debug and check

I ran it in debug mode. When there is data in the worksheet, the column headers are fine, but if there’s no data, then the column headers are deleted. Would I need to incorporate an if workflow?

I understand what is happening now. The delete range is using the row count. Since row count is only 2, it’s deleting A3:BI2. For simplification, can I just add 2 to delete range?

image

Hi,

How about the following?

"A3:BI"+(FYrowcount +2).ToString

Regards,

This worked. Thank you!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.