ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   adding data column without changing sheets (https://www.excelbanter.com/excel-programming/434208-adding-data-column-without-changing-sheets.html)

Fan924

adding data column without changing sheets
 
I am on Sheet1 and I want to run this macro without changing sheets.
I am adding data column on Sheet2 using the following and the result
on Sheet1. The way I am doing it now changes the displayed sheet and
then returns to Sheet1. This is not what I want. TIA

Worksheets("Sheet2").Select
vData = Range("C" & RowStart & ":C" & RowStop).Value2
For j = LBound(vData) To UBound(vData)
ChkSum = ChkSum + Val("&h" & UCase(vData(j, 1)))
Next j
Worksheets("Sheet1").Select

Tim Williams[_2_]

adding data column without changing sheets
 
vData = Worksheets("Sheet2").Range("C" & RowStart & ":C" &
RowStop).Value2
For j = LBound(vData) To UBound(vData)
ChkSum = ChkSum + Val("&h" & UCase(vData(j, 1)))
Next j

Tim


"Fan924" wrote in message
...
I am on Sheet1 and I want to run this macro without changing sheets.
I am adding data column on Sheet2 using the following and the result
on Sheet1. The way I am doing it now changes the displayed sheet and
then returns to Sheet1. This is not what I want. TIA

Worksheets("Sheet2").Select
vData = Range("C" & RowStart & ":C" & RowStop).Value2
For j = LBound(vData) To UBound(vData)
ChkSum = ChkSum + Val("&h" & UCase(vData(j, 1)))
Next j
Worksheets("Sheet1").Select




Fan924

adding data column without changing sheets
 
Thanks Tim, workes great!


All times are GMT +1. The time now is 01:41 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com