![]() |
what is the best way to do calculation via vba
Barrowing from another macro for example I would like to apply a calaculation
to a column of data. I have a specifc calculation i ma interesting in using but would like to apply this theory to using allot fo different clacs with vba against my different columns of data. The formula that I want to programmicaly apply is: =INT(A1)&":"&TEXT(A1,hh:mm") A1 being the target field So what is the best way to build a generic macro where I can change what row I start in and what range I am targetting and what range I am sending result to The following are pieces from someone elses macro - it works great: The code looks at colmn b and offsets 1 to c and it starts int he second row Sub ProcessData() Dim col As Long, rng As Range Dim cell As Range, sStr As String col = 2 ' "B" Set rng = Range(Cells(2, col), Cells(2, col).End(xlDown)) For Each cell In rng later in macro End Select cell.Offset(0, 1).Value = sStr Next I am open to sugggestion but I would like to also learn how to do this so can apply lots of diffent calcs and formula sto my data via VBA Hey thansk for your time. |
All times are GMT +1. The time now is 11:07 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com