J
John
I am really new to VBA. I am building a tool that extracts random records
using the row numbers in Excel. The random numbers are generated by an
outside source and come in the format '123, 456, 789'
I've created a code that exctracts rows 123, 456, 789.
'///////////CODE BEGINS HERE/////////////
Range("A123,A456,A789").EntireRow.Copy
Sheets("Sample").Select
ActiveSheet.Range("A1").Select
ActiveCell.PasteSpecial (xlPasteValuesAndNumberFormats)
Application.CutCopyMode = False
End Sub
'//////////CODE ENDS HERE//////////////////
To get to this point requires a lot of massaging of the numbers in VBA
(adding the 'A' and removing the spaces) usually using global search and
replace. This is simple enough for me, but not simple enough for some end
users.
I want to use an input box or other pop-up type tool imbedded in the macro
that allows the user to input the numbers as a group (copy and paste in one
step) in the format supplied to them (e.g. '123, 456, 789') that will
automatically convert them to the correct format (e.g. 'A123,A456,A789') and
then update the RANGE line of the macro built above before the macro
continues past this point.
Any help will be appreciated.
Thanks,
using the row numbers in Excel. The random numbers are generated by an
outside source and come in the format '123, 456, 789'
I've created a code that exctracts rows 123, 456, 789.
'///////////CODE BEGINS HERE/////////////
Range("A123,A456,A789").EntireRow.Copy
Sheets("Sample").Select
ActiveSheet.Range("A1").Select
ActiveCell.PasteSpecial (xlPasteValuesAndNumberFormats)
Application.CutCopyMode = False
End Sub
'//////////CODE ENDS HERE//////////////////
To get to this point requires a lot of massaging of the numbers in VBA
(adding the 'A' and removing the spaces) usually using global search and
replace. This is simple enough for me, but not simple enough for some end
users.
I want to use an input box or other pop-up type tool imbedded in the macro
that allows the user to input the numbers as a group (copy and paste in one
step) in the format supplied to them (e.g. '123, 456, 789') that will
automatically convert them to the correct format (e.g. 'A123,A456,A789') and
then update the RANGE line of the macro built above before the macro
continues past this point.
Any help will be appreciated.
Thanks,