ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   copying a macro to several cells (https://www.excelbanter.com/excel-programming/320846-copying-macro-several-cells.html)

rkibui

copying a macro to several cells
 
Hi All,
I want to copy a macro to several cells with the results showing next to the
columns
e.g.
marks grades
85 A
75 B
65 C
50 D
instead of me running the macro every time for each student.







Jim Thomlinson[_3_]

copying a macro to several cells
 
I concure with Norman that you don't need a macro for this... That having
been said here is the code you want

dim rngCurrent as range

set rngCurrent = sheet1.range("A2")

do while rngcurrent.value < Empty
rngcurrent.select 'This assumes that your macro works using selection
'Call your macro here...
loop

set rngCurrent = nothing

That having been said you should really look at the vlookup function...

HTH

"rkibui" wrote:

Hi All,
I want to copy a macro to several cells with the results showing next to the
columns
e.g.
marks grades
85 A
75 B
65 C
50 D
instead of me running the macro every time for each student.








All times are GMT +1. The time now is 09:44 AM.

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