Step 1: Use the condition for maximum and minimum.
If a function attains maximum or minimum at a point, then its first derivative at that point must be zero. Since the function has maximum at \(x=1\) and minimum at \(x=2\), we must have:
\[
f'(1)=0 \quad \text{and} \quad f'(2)=0
\]
Step 2: Differentiate the given function.
The given function is:
\[
f(x)=ax^3-9x^2+6ax+6
\]
Differentiating with respect to \(x\), we get:
\[
f'(x)=3ax^2-18x+6a
\]
Step 3: Apply the condition \(f'(1)=0\).
Substitute \(x=1\) into the derivative:
\[
f'(1)=3a(1)^2-18(1)+6a=0
\]
\[
3a-18+6a=0
\]
\[
9a-18=0
\]
\[
9a=18
\]
\[
a=2
\]
Step 4: Apply the condition \(f'(2)=0\).
Now substitute \(x=2\):
\[
f'(2)=3a(2)^2-18(2)+6a=0
\]
\[
12a-36+6a=0
\]
\[
18a-36=0
\]
\[
18a=36
\]
\[
a=2
\]
So both conditions consistently give:
\[
a=2
\]
Step 5: Verify the nature of extrema using second derivative.
Differentiate again:
\[
f''(x)=6ax-18
\]
Now put \(a=2\):
\[
f''(x)=12x-18
\]
Step 6: Check at \(x=1\) and \(x=2\).
At \(x=1\):
\[
f''(1)=12-18=-6<0
\]
So \(x=1\) is a point of maximum.
At \(x=2\):
\[
f''(2)=24-18=6>0
\]
So \(x=2\) is a point of minimum. This confirms the result.
Step 7: State the final answer.
Hence, the required value of \(a\) is:
\[
\boxed{2}
\]
which matches option \((5)\).