tomtom412
03-12-2017, 11:54 AM
Hi
So I've got a sheet that is linked to several userforms via VBA and these userforms are used by the user to populate data and information to the respective cells in my sheet!
Now thats all well and good, and works just as I want it, until I have to make a change to sheet, in the form of adding or deleting rows.
When this happens, because i've hardcoded all the cell references into the code functions, e.g.
Range("A1").Value = TextBox1.Value
I would then have to go back and re-assign the correct cell references for where I want data to go from the userform.
My question is: Is is possible to have some sort of anchoring or relative referencing in vba, as there is when hand writing in formulas in excel using "$" to signify what you want to stay constant when references move? I have only started using vba recently and so my knowledge of the capabilities of the program is limited so I would be incredibly grateful for any help whatsoever!
I've attached a sample representation of what my original worksheet looks like and functions: a simple set of variable data/info is inputted using a userform activated by a command button on the sheet! Any help or advice on how to do this better would be amazing!
Thanks
Tom
So I've got a sheet that is linked to several userforms via VBA and these userforms are used by the user to populate data and information to the respective cells in my sheet!
Now thats all well and good, and works just as I want it, until I have to make a change to sheet, in the form of adding or deleting rows.
When this happens, because i've hardcoded all the cell references into the code functions, e.g.
Range("A1").Value = TextBox1.Value
I would then have to go back and re-assign the correct cell references for where I want data to go from the userform.
My question is: Is is possible to have some sort of anchoring or relative referencing in vba, as there is when hand writing in formulas in excel using "$" to signify what you want to stay constant when references move? I have only started using vba recently and so my knowledge of the capabilities of the program is limited so I would be incredibly grateful for any help whatsoever!
I've attached a sample representation of what my original worksheet looks like and functions: a simple set of variable data/info is inputted using a userform activated by a command button on the sheet! Any help or advice on how to do this better would be amazing!
Thanks
Tom