If you recorded a keyboard macro, but did not get it quite right, you can actually make changes to that recorded macro.
Here is how.
First, see Vim macros for most of what you need to know about recording and using macros.
Now, suppose that you have recorded your macro in register "a. While in normal mode do the following:
1. Type:
:let @a='
2. Press Ctrl-R then "a" to insert the previous contents of register "a.
3. Edit and modify it, then close the quote.
4. Press return.
Use ":registers" to view the new value in that register.
Use "@a" to execute the contents of register "a.