on 12-19-2018 2:00 PM
Hello Team,
I have followed the following link to get the range of crosstab to use in formulas.
https://archive.sap.com/discussions/thread/3571943#
In code i used... cells(1,2) or range("B1") to write the result of ifirstrow, ilastrow etc to my excel. Its works wonderfully, gives results as expected when the sheet is not protected. However, When the sheet is protected, it gives Run time: 1004 error at the "cells(1,2) = ifirstrow " line. However, when i use code like "MsgBox ifirstrow" the doesn't throw error.
Please suggest, how to work it out.
Code is as below:
ifirstrow = Range("SAPCrosstab1").Row
MsgBox ifirstrow ' Works with protected sheet
'Range("B6").value = ifirstrow
'Cells(1, 2) = ifirstrow
ilastrow = Range("SAPCrosstab1").Rows.Count + ifirstrow - 1
Cells(2, 2) = ilastrow ' gives runtime error : 1004, on protected sheet
iFirstColumn = Range("SAPCrosstab1").Column
Cells(3, 2) = iFirstColumn
iLastColumn = Range("SAPCrosstab1").Columns.Count + iFirstColumn - 1
Cells(4, 2) = iLastColumn
Regards,
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.