SOLVED
Home

Create a pop-up form for entering current 'block' of cells

%3CLINGO-SUB%20id%3D%22lingo-sub-717013%22%20slang%3D%22en-US%22%3ECreate%20a%20pop-up%20form%20for%20entering%20current%20'block'%20of%20cells%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-717013%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20a%20block%20of%20cells%20that%20I%20wish%20to%20enter%20at%20various%20points%20through%20my%20spreadsheet.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EA%20couple%20of%20'blocks'%20that%20I%20have%20already%20done%20'manually'%20are%20as%20follows%20%E2%80%93%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CTABLE%3E%3CTBODY%3E%3CTR%3E%3CTD%3E%3CP%3EFather%3A%20Christophori%20Johnson%3C%2FP%3E%3C%2FTD%3E%3CTD%3E%3CP%3EMaria%20Johnson%3C%2FP%3E%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E%3CP%3EMother%3A%20Anna%3C%2FP%3E%3C%2FTD%3E%3CTD%3E%3CP%3EBaptism%3A%201769%20at%20St.%20Andrew's%2C%20Dublin%3C%2FP%3E%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E%3CP%3EFather%3A%20Alexandri%20Johnson%3C%2FP%3E%3C%2FTD%3E%3CTD%3E%3CP%3EMargareta%20Johnson%3C%2FP%3E%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E%3CP%3EMother%3A%20Maria%3C%2FP%3E%3C%2FTD%3E%3CTD%3E%3CP%3EBaptism%3A%201747%20at%20St.%20Andrew's%2C%20Dublin%3C%2FP%3E%3C%2FTD%3E%3C%2FTR%3E%3C%2FTBODY%3E%3C%2FTABLE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThese%20two%20'record'%20blocks%20happen%20to%20be%20sitting%20in%20rows%2091%20through%2094%20and%20columns%20D%20and%20E%20BUT%20the%20eventual%20data%20(possibly%20hundreds%20of%20blocks%20of%204)%20could%20need%20to%20be%20entered%20in%20any%20four%20contiguous%20cells.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAs%20you%20can%20see%20much%20of%20the%20content%20is%20similar%2C%20and%20it%20is%20that%20fact%20that%20I%20was%20hoping%20to%20address%20by%20creating%20a%20'dynamic'%20user%20form.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBasically%20I%20want%20to%20be%20able%20to%20click%20(or%20maybe%20use%20a%20special%20key%20sequence%20such%20as%20Shift%20Alt%20%7Bsome%20letter%7D)%20in%20a%20cell%2C%20the%20form%20then%20pop%20up%2C%20I%20then%20enter%20the%20variable%20data%20and%20then%2C%20when%20I%20press%20Enter%2C%20the%20'record'%20populates%20the%20four%20cells%2C%20with%20the%20entered%20data%2C%20plus%20the%20constant%20text%2C%20the%20top%20left%20of%20which%20being%20the%20one%20where%20I%20clicked%20%2F%20special%20keyed.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20is%20like%20entering%20a%20new%20record%20in%20a%20set%20of%20records%20with%20a%20common%20set%20of%20headings%20BUT%20as%20the%20top%20left%20corner%20may%20change%2C%20from%20'record'%20to%20'record'%2C%20I%20am%20unable%20to%20use%20the%20'standard'%20form%20and%20new%20record%20approach.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAny%20ideas%2C%20please.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBest%20regards%3C%2FP%3E%3CP%3EPhilip%3CBR%20%2F%3EBendigo%2C%20Victoria%3CBR%20%2F%3EAustralia%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-717013%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EForms%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMacros%20and%20VBA%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-717195%22%20slang%3D%22en-US%22%3ERe%3A%20Create%20a%20pop-up%20form%20for%20entering%20current%20'block'%20of%20cells%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-717195%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F313780%22%20target%3D%22_blank%22%3E%40PMHunt1955%3C%2FA%3E%26nbsp%3B%3CFONT%20style%3D%22background-color%3A%20%23ffffff%3B%22%3EI%20would%20advise%20you%20NOT%20to%20combine%20the%20constant%20text%20with%20the%20actual%20information%20in%20one%20single%20cell.%20It%20will%20make%20your%20life%20a%20whole%20lot%20easier%20if%20you%20create%20a%20simple%20table%20with%20these%205%20headings%3A%3CBR%20%2F%3EFirst%20name%26nbsp%3B%26nbsp%3B%20Last%20Name%26nbsp%3B%26nbsp%3B%20Father%26nbsp%3B%26nbsp%3B%20Mother%26nbsp%3B%26nbsp%3B%20Baptism%3CBR%20%2F%3Eand%20beneath%20this%20header%20row%20you%20enter%20one%20row%20of%20data%20per%20person.%20See%20attached.%3CBR%20%2F%3E%3C%2FFONT%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-717198%22%20slang%3D%22en-US%22%3ERe%3A%20Create%20a%20pop-up%20form%20for%20entering%20current%20'block'%20of%20cells%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-717198%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F22322%22%20target%3D%22_blank%22%3E%40Jan%20Karel%20Pieterse%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDear%20Jan%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhilst%20I%20know%20that%20your%20approach%20would%20be%20simpler%2C%20there%20are%20a%20whole%20load%20of%20reasons%20why%20I%20want%20to%20enter%20the%20data%20in%20the%20way%20that%20I%20have%20described.%26nbsp%3B%20I%20am%20an%20intermediate%20level%20VBA%20programmer%20so%20I%20am%20quite%20happy%20to%20write%20the%20necessary%20code%2C%20but%20I%20was%20just%20hoping%20for%20some%20guidance.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBest%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPhilip%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-717289%22%20slang%3D%22en-US%22%3ERe%3A%20Create%20a%20pop-up%20form%20for%20entering%20current%20'block'%20of%20cells%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-717289%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F313780%22%20target%3D%22_blank%22%3E%40PMHunt1955%3C%2FA%3E%26nbsp%3B%3CFONT%20style%3D%22background-color%3A%20%23ffffff%3B%22%3EIf%20you%20insist%20on%20having%20this%20layout%20%3A-)%20I%20guess%20the%20best%20way%20is%20to%20insert%20a%20userform%20into%20your%20VBA%20project%20with%20the%20appropriate%20number%20of%20textboxes.%20It%20is%20a%20good%20idea%20to%20name%20each%20textbox%20after%20you've%20added%20it%20using%20the%20properties%20windows%20(View%2C%20properties).%20Assuming%20the%20top-left%20cell%20of%20a%20%22block%22%20is%20selected%20when%20the%20form%20is%20opened%2C%20you%20can%20then%20add%20the%20entries%20of%20the%20textboxes%20into%20the%20cells%20when%20the%20user%20clicks%20the%20OK%20button%20(I%20called%20it%20cmbOK)%2C%20The%20code%20for%20the%20OK%20button%20would%20be%20something%20like%3A%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3EPrivate%20Sub%20cmbOK_Click()%0A%20%20%20%20With%20ActiveCell%0A%20%20%20%20%20%20%20%20.Value%20%3D%20%22Father%3A%20%22%20%26amp%3B%20tbxFather.Value%0A%20%20%20%20%20%20%20%20.Offset(0%2C%201).Value%20%3D%20tbxFirstName.Value%20%26amp%3B%20%22%20%22%20%26amp%3B%20tbxLastName.Value%0A%20%20%20%20%20%20%20%20.Offset(1%2C%200).Value%20%3D%20%22Mother%3A%20%22%20%26amp%3B%20tbxMother.Value%0A%20%20%20%20%20%20%20%20.Offset(1%2C%201).Value%20%3D%20%22Baptism%3A%20%22%20%26amp%3B%20tbxBaptism.Value%0A%20%20%20%20End%20With%0AEnd%20Sub%0A%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-718731%22%20slang%3D%22en-US%22%3ERe%3A%20Create%20a%20pop-up%20form%20for%20entering%20current%20'block'%20of%20cells%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-718731%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F22322%22%20target%3D%22_blank%22%3E%40Jan%20Karel%20Pieterse%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20created%20the%20form%20(Name%20%3D%20Enter_Baptism)%2C%20and%20code%2C%20but%20I%20am%20having%20difficulty%20in%20assigning%20the%20shortcut.%26nbsp%3B%20There%20are%20in%20fact%20two%20issues%20associated%20therewith%20-%20i.%20I%20cannot%20get%20the%20shortcut%20to%20call%20the%20form%20and%20ii.%20I%20cannot%20assign%20the%20shortcut%20that%20I%20really%20want.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CU%3EForm%20Code%3C%2FU%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%5BCODE%5D%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPrivate%20Sub%20Baptism_OK_Click()%3CBR%20%2F%3E%3CBR%20%2F%3EWith%20ActiveCell%3CBR%20%2F%3E%3CBR%20%2F%3E.Value%20%3D%20%22Father%3A%20%22%20%26amp%3B%20txt_Father.Value%3CBR%20%2F%3E.Offset(0%2C%201).Value%20%3D%20txt_Child.Value%3CBR%20%2F%3E.Offset(1%2C%200).Value%20%3D%20%22Mother%3A%20%22%20%26amp%3B%20txt_Mother.Value%3CBR%20%2F%3E.Offset(1%2C%201).Value%20%3D%20%22Baptism%3A%20%22%20%26amp%3B%20txt_Baptism.Value%20%26amp%3B%20%22%20at%20St%20Andrew's%2C%20Dublin%22%3CBR%20%2F%3E%3CBR%20%2F%3EEnd%20With%3C%2FP%3E%3CP%3EEnd%20Sub%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPrivate%20Sub%20cmd_Close_Click()%3C%2FP%3E%3CP%3EUnload%20Me%3C%2FP%3E%3CP%3EEnd%20Sub%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%5B%2FCODE%5D%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CU%3EAttempt%20at%20code%20to%20cause%20calling%20up%20of%20form%3C%2FU%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%5BCODE%5D%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPrivate%20Sub%20Show_Baptism_Entry_Form()%3C%2FP%3E%3CP%3EEnter_Baptism.Show%3C%2FP%3E%3CP%3EEnd%20Sub%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPrivate%20Sub%20Worksheet_SelectionChange(ByVal%20Target%20As%20Range)%3C%2FP%3E%3CP%3EApplication.OnKey%20%22%2B%5E%7BRIGHT%7D%22%2C%20%22Show_Baptism_Entry_Form%22%3C%2FP%3E%3CP%3EEnd%20Sub%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%5B%2FCODE%5D%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20clicking%20of%20CTRL%20%2B%20Shift%20%2B%20Right%20displays%20a%20message%2C%20which%20says%26nbsp%3B%20that%20Show_Baptism_Entry_Form%20cannot%20be%20found.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20I%20click%20Macros%20in%20the%20Developer%26gt%3BCode%20part%20of%20the%20ribbon%20and%20type%20Sheet1.Show_Baptism_Entry_Form%20explicitly%20into%20the%20name%20field%2C%20the%20form%20then%20displays%20and%20acts%20correctly.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20tried%20the%20line%20Application.OnKey%20%22%2B%5E%7BRIGHT%7D%22%2C%20%22Show_Baptism_Entry_Form%22%2C%20both%20with%20and%20without%20Sheet1.%20typed%20in%20before%20Show_Baptism_Entry_Form%2C%20neither%20approach%20works.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20really%20wanted%20the%20key%20sequence%20to%20be%20Ctrl%2BShift%2BB%2C%20but%20I%20cannot%20get%20the%20system%20to%20recognise%20that%20at%20all.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFinally%20I%20must%20apologise%20for%20not%20formatting%20the%20above%20code%20examples%20correctly.%26nbsp%3B%20I%20cannot%20find%20here%20on%20the%20forum%20a%20simple%20set%20of%20instructions%20regarding%20how%20to%20insert%20code%20in%20posts.%26nbsp%3B%20I%20tried%20the%20Formats%20pull%20down%20but%2C%20though%20there%20is%20a%20code%20option%20there%2C%20I%20am%20obviously%20not%20using%20it%20correctly%2C%20as%20the%20Preview%20said%20that%20there%20was%20invalid%20HTML.%26nbsp%3B%20With%20apologies%20for%20mentioning%20another%20board%2C%20it%20is%20so%20much%20simpler%20on%20MrExcel%2C%20all%20one%20does%20there%20is%20type%20%5BCODE%5D%20and%20%5B%2FCODE%5D%20either%20side%20of%20the%20code%20and%20it%20works%2C%20as%20I%20have%20shown%20above.%26nbsp%3B%20I%20should%20be%20grateful%20for%20some%20similarly%20simple%20instructions%20as%20to%20how%20to%20achieve%20the%20same%20result%20here%20on%20this%20forum%2C%20please.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWith%20thanks%20in%20anticipation.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPhilip%3C%2FP%3E%3CP%3EBendigo%2C%20Victoria%3C%2FP%3E%3CP%3EAustralia%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-719212%22%20slang%3D%22en-US%22%3ERe%3A%20Create%20a%20pop-up%20form%20for%20entering%20current%20'block'%20of%20cells%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-719212%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F313780%22%20target%3D%22_blank%22%3E%40PMHunt1955%3C%2FA%3E%20Hi%20Philip%2C%20to%20start%20with%20your%20last%20question%3A%20if%20you%20click%20the%20Reply%20button%20rather%20than%20the%20%22Quick%20reply%22%20button%20and%20select%20the%20Rich%20Text%20tab%20at%20the%20top%20of%20the%20small%20reply%20window%2C%20you%20should%20see%20a%20button%20.%20Click%20that%20to%20insert%20code.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETo%20your%20other%20questions.%3C%2FP%3E%0A%3CP%3EBest%20to%20put%20both%20the%20OnKey%20routine%20and%20the%20routine%20that%20opens%20the%20form%20%3CSTRONG%3Ein%20a%20normal%20module%3C%2FSTRONG%3E%3A%3C%2FP%3E%0A%3CPRE%3ESub%20ShowBaptismEntryForm()%0A%20%20%20%20Enter_Baptism.Show%0AEnd%20Sub%0A%0ASub%20SetHotKey()%0A%20%20%20%20Application.OnKey%20%22%2B%5Eb%22%2C%20%22ShowBaptismEntryForm%22%0AEnd%20Sub%0A%0ASub%20ResetHotKey()%0A%20%20%20%20Application.OnKey%20%22%2B%5Eb%22%0AEnd%20Sub%0A%3C%2FPRE%3E%0A%3CP%3EAnd%20in%20ThisWorkbook%3A%3C%2FP%3E%0A%3CPRE%3EPrivate%20Sub%20Workbook_BeforeClose(Cancel%20As%20Boolean)%0A%20%20%20ResetHotKey%0AEnd%20Sub%0A%0APrivate%20Sub%20Workbook_Open()%0A%20%20%20%20SetHotKey%0AEnd%20Sub%0A%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-719458%22%20slang%3D%22en-US%22%3ERe%3A%20Create%20a%20pop-up%20form%20for%20entering%20current%20'block'%20of%20cells%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-719458%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F22322%22%20target%3D%22_blank%22%3E%40Jan%20Karel%20Pieterse%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDear%20Jan%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20for%20all%20of%20that.%26nbsp%3B%20I%20got%20it%20to%20work.%26nbsp%3B%20Just%20one%20point%20about%20the%20normal%20module%2C%20for%20anyone%20else%20reading%20this%20-%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20normal%20module%2C%20where%20the%20subroutines%20are%20put%2C%20has%20to%20be%20a%20module%20within%20the%20xlsm%20workbook%20not%20one%20of%20the%20modules%2C%20within%20an%20xlam%2C%20where%20one's%20functions%20code%20is%20placed.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERe%20the%20entering%20of%20code%20in%20these%20posts.%26nbsp%3B%20There%20is%20no%20%20button%20in%20my%20browser%20display%2C%20neither%20when%20using%20Firefox%20or%20Edge.%26nbsp%3B%20There%20is%20a%20Formats%20dropdown%2C%20which%20includes%2C%20under%20the%20option%20Inline%2C%20%26lt%3B%26gt%3B%20Code%20(in%20red%20with%20a%20pink%20background).%26nbsp%3B%20Clicking%20on%20that%20produces%20a%20pink%20blob%2C%20upon%20which%2C%20I%20suppose%2C%20I%20write%20code.%26nbsp%3B%20I%20tried%20that%2C%20and%20all%20it%20did%2C%20when%20I%20previewed%20my%20reply%2C%20was%20cause%20the%20system%20to%20say%20the%20post%20included%20invalid%20HTML%20and%20it%20stripped%20it%20out.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20also%20tried%20i.%20clicking%20the%20pink%20option%2C%20then%20typing%20the%20code%20after%20the%20pink%20blob%2C%20which%20simply%20sent%20the%20pink%20blob%20away%2C%20and%20ii.%20typing%20the%20code%20and%20then%20surrounding%20it%20with%20that%20inline%20code%2C%20but%2C%20again%2C%20it%20just%20got%20stripped%20out%20with%20the%20message%20-%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EYour%20post%20has%20been%20changed%20because%20invalid%20HTML%20was%20found%20in%20the%20message%20body.%20The%20invalid%20HTML%20has%20been%20removed.%20Please%20review%20the%20message%20and%20submit%20the%20message%20when%20you%20are%20satisfied.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EEven%20the%20copy%20and%20pasting%20of%20this%20message%2C%20which%20came%20up%20in%20red%2C%20and%20therefore%20pasted%20in%20red%2C%20caused%20the%20same%20error%20message%20to%20appear.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EI%20wish%20I%20could%20master%20this%20one%2C%20but%20it%20has%20stumped%20me.%26nbsp%3B%20If%20I%20could%20be%20given%20an%20exact%20key%20stroke%20by%20key%20stroke%20set%20of%20instructions%20then%20that%20would%20be%20great%20but%2C%20basically%2C%20in%20my%20experience%2C%20this%20board%20makes%20the%20posting%20of%20code%2C%20within%20a%20post%2C%20just%20way%20too%20difficult%3B%20Mr%20Excel's%20approach%20is%20so%20much%20easier.%26nbsp%3B%20Dear%20Jan%2C%20please%20do%20not%20take%20this%20as%20directed%20to%20you%3B%20I%20just%20hope%20one%20of%20the%20board%20moderators%20sees%20this%20comment%20and%20posts%20such%20a%20simple%20set%20of%20instructions%20and%2For%20changes%20the%20way%20that%20code%20is%20entered%2C%20in%20a%20post%2C%20to%20a%20much%20simpler%20method%2C%20like%20that%20found%20on%20MrExcel.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%2C%20Jan%2C%20once%20again%20for%20persevering%20with%20me%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBest%3CBR%20%2F%3E%3CBR%20%2F%3EPhilip%3CBR%20%2F%3EBendigo%2C%20Victoria%3CBR%20%2F%3EAustralia%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-719483%22%20slang%3D%22en-US%22%3ERe%3A%20Create%20a%20pop-up%20form%20for%20entering%20current%20'block'%20of%20cells%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-719483%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F313780%22%20target%3D%22_blank%22%3E%40PMHunt1955%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ERegarding%20this%3A%3C%2FP%3E%0A%3CP%3E%22%3CSPAN%20style%3D%22display%3A%20inline%20!important%3B%20float%3A%20none%3B%20background-color%3A%20%23ffffff%3B%20color%3A%20%23333333%3B%20font-family%3A%20'SegoeUI'%2C'Lato'%2C'Helvetica%20Neue'%2CHelvetica%2CArial%2Csans-serif%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%22%3EThe%20normal%20module%2C%20where%20the%20subroutines%20are%20put%2C%20has%20to%20be%20a%20module%20within%20the%20xlsm%20workbook%20not%20one%20of%20the%20modules%2C%20within%20an%20xlam%2C%20where%20one's%20functions%20code%20is%20placed.%3C%2FSPAN%3E%22%3C%2FP%3E%0A%3CP%3ENot%20sure%20why%20you%20say%20that%3F%3C%2FP%3E%0A%3CP%3ETo%20the%20insert%20code%20button%2C%20please%20see%20attached%20screen-shots%20(taken%20in%20Edge%20under%20Windows%2010).%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20805px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F120569i0A1DBA78B88E5397%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Insert%20code%20button.jpg%22%20title%3D%22Insert%20code%20button.jpg%22%20%2F%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20862px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F120568i2139948878A6F1B5%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Insert%20code%20dialog.jpg%22%20title%3D%22Insert%20code%20dialog.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-719496%22%20slang%3D%22en-US%22%3ERe%3A%20Create%20a%20pop-up%20form%20for%20entering%20current%20'block'%20of%20cells%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-719496%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F22322%22%20target%3D%22_blank%22%3E%40Jan%20Karel%20Pieterse%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDear%20Jan%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20for%20posting%20all%20of%20that.%26nbsp%3B%20I%20made%20the%20comment%20re%20where%20the%20module%20needed%20to%20be%2C%20because%20I%20originally%20put%20the%20code%20in%20my%20xlam%2C%20where%20all%20my%20functions%20are%2C%20and%20the%20'process'%20did%20not%20work.%26nbsp%3B%20It%20was%20only%20when%20I%20created%20a%20Modules%26gt%3BModule1%20within%20the%20workbook%2C%20which%20is%20the%20subject%20of%20this%20discussion%2C%20and%20placed%20the%20code%20there%2C%20in%20Module1%2C%20that%20the%20'process'%20worked.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20for%20all%20those%20screen%20dumps%20and%20annotations%20re%20posting%20code.%26nbsp%3B%20Unfortunately%20my%20display%20only%20includes%20a%20little%20less%20than%20half%20of%20the%20icons%20%2F%20options%20that%20yours%20does.%26nbsp%3B%20See%20picture.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F120570i0D095300550C78AD%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22My_display_in_reply_on_Microsoft_Excel_forum.jpg%22%20title%3D%22My_display_in_reply_on_Microsoft_Excel_forum.jpg%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EThe%20%22top%22%20of%20my%20forum%20postings%20Reply%20'window'%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EI%20get%20the%20same%20'top'%20whether%20I%20am%20in%20Edge%20or%20Firefox%2C%20and%20I%20am%20using%20Windows%2010%20(automatic%20update).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBest%20regards%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPhilip%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-719604%22%20slang%3D%22en-US%22%3ERe%3A%20Create%20a%20pop-up%20form%20for%20entering%20current%20'block'%20of%20cells%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-719604%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F313780%22%20target%3D%22_blank%22%3E%40PMHunt1955%3C%2FA%3E%20I%20honestly%20have%20no%20idea%20what%20causes%20your%20buttons%20to%20be%20less%20in%20number%20than%20mine.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-719622%22%20slang%3D%22en-US%22%3ERe%3A%20Create%20a%20pop-up%20form%20for%20entering%20current%20'block'%20of%20cells%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-719622%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F22322%22%20target%3D%22_blank%22%3E%40Jan%20Karel%20Pieterse%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20for%20that.%26nbsp%3B%20Hopefully%20a%20moderator%20may%20see%20this%20and%20suggest%20why.%26nbsp%3B%20Anyway%2C%20thank%20you%20once%20again%20for%20all%20your%20help.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBest%20regards%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPhilip%3C%2FP%3E%3C%2FLINGO-BODY%3E
PMHunt1955
Occasional Contributor

I have a block of cells that I wish to enter at various points through my spreadsheet.

 

A couple of 'blocks' that I have already done 'manually' are as follows –

 

Father: Christophori Johnson

Maria Johnson

Mother: Anna

Baptism: 1769 at St. Andrew's, Dublin

Father: Alexandri Johnson

Margareta Johnson

Mother: Maria

Baptism: 1747 at St. Andrew's, Dublin

 

These two 'record' blocks happen to be sitting in rows 91 through 94 and columns D and E BUT the eventual data (possibly hundreds of blocks of 4) could need to be entered in any four contiguous cells.

 

As you can see much of the content is similar, and it is that fact that I was hoping to address by creating a 'dynamic' user form.

 

Basically I want to be able to click (or maybe use a special key sequence such as Shift Alt {some letter}) in a cell, the form then pop up, I then enter the variable data and then, when I press Enter, the 'record' populates the four cells, with the entered data, plus the constant text, the top left of which being the one where I clicked / special keyed.

 

This is like entering a new record in a set of records with a common set of headings BUT as the top left corner may change, from 'record' to 'record', I am unable to use the 'standard' form and new record approach.

 

Any ideas, please.

 

Best regards

Philip
Bendigo, Victoria
Australia

10 Replies

@PMHunt1955 I would advise you NOT to combine the constant text with the actual information in one single cell. It will make your life a whole lot easier if you create a simple table with these 5 headings:
First name   Last Name   Father   Mother   Baptism
and beneath this header row you enter one row of data per person. See attached.

@Jan Karel Pieterse 

Dear Jan

 

Whilst I know that your approach would be simpler, there are a whole load of reasons why I want to enter the data in the way that I have described.  I am an intermediate level VBA programmer so I am quite happy to write the necessary code, but I was just hoping for some guidance.

 

Best

 

Philip

@PMHunt1955 If you insist on having this layout :-) I guess the best way is to insert a userform into your VBA project with the appropriate number of textboxes. It is a good idea to name each textbox after you've added it using the properties windows (View, properties). Assuming the top-left cell of a "block" is selected when the form is opened, you can then add the entries of the textboxes into the cells when the user clicks the OK button (I called it cmbOK), The code for the OK button would be something like:

 

Private Sub cmbOK_Click()
    With ActiveCell
        .Value = "Father: " & tbxFather.Value
        .Offset(0, 1).Value = tbxFirstName.Value & " " & tbxLastName.Value
        .Offset(1, 0).Value = "Mother: " & tbxMother.Value
        .Offset(1, 1).Value = "Baptism: " & tbxBaptism.Value
    End With
End Sub

@Jan Karel Pieterse 

 

I have created the form (Name = Enter_Baptism), and code, but I am having difficulty in assigning the shortcut.  There are in fact two issues associated therewith - i. I cannot get the shortcut to call the form and ii. I cannot assign the shortcut that I really want.

 

Form Code

 

[CODE]

 

Private Sub Baptism_OK_Click()

With ActiveCell

.Value = "Father: " & txt_Father.Value
.Offset(0, 1).Value = txt_Child.Value
.Offset(1, 0).Value = "Mother: " & txt_Mother.Value
.Offset(1, 1).Value = "Baptism: " & txt_Baptism.Value & " at St Andrew's, Dublin"

End With

End Sub

 

Private Sub cmd_Close_Click()

Unload Me

End Sub

 

[/CODE]

 

Attempt at code to cause calling up of form

 

[CODE]

 

Private Sub Show_Baptism_Entry_Form()

Enter_Baptism.Show

End Sub

 

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Application.OnKey "+^{RIGHT}", "Show_Baptism_Entry_Form"

End Sub

 

[/CODE]

 

The clicking of CTRL + Shift + Right displays a message, which says  that Show_Baptism_Entry_Form cannot be found.

 

If I click Macros in the Developer>Code part of the ribbon and type Sheet1.Show_Baptism_Entry_Form explicitly into the name field, the form then displays and acts correctly.

 

I have tried the line Application.OnKey "+^{RIGHT}", "Show_Baptism_Entry_Form", both with and without Sheet1. typed in before Show_Baptism_Entry_Form, neither approach works.

 

I really wanted the key sequence to be Ctrl+Shift+B, but I cannot get the system to recognise that at all.

 

Finally I must apologise for not formatting the above code examples correctly.  I cannot find here on the forum a simple set of instructions regarding how to insert code in posts.  I tried the Formats pull down but, though there is a code option there, I am obviously not using it correctly, as the Preview said that there was invalid HTML.  With apologies for mentioning another board, it is so much simpler on MrExcel, all one does there is type [CODE] and [/CODE] either side of the code and it works, as I have shown above.  I should be grateful for some similarly simple instructions as to how to achieve the same result here on this forum, please.

 

With thanks in anticipation.

 

Philip

Bendigo, Victoria

Australia

 

Solution

@PMHunt1955 Hi Philip, to start with your last question: if you click the Reply button rather than the "Quick reply" button and select the Rich Text tab at the top of the small reply window, you should see a button </>. Click that to insert code.

 

To your other questions.

Best to put both the OnKey routine and the routine that opens the form in a normal module:

Sub ShowBaptismEntryForm()
    Enter_Baptism.Show
End Sub

Sub SetHotKey()
    Application.OnKey "+^b", "ShowBaptismEntryForm"
End Sub

Sub ResetHotKey()
    Application.OnKey "+^b"
End Sub

And in ThisWorkbook:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
   ResetHotKey
End Sub

Private Sub Workbook_Open()
    SetHotKey
End Sub

 

 

 

@Jan Karel Pieterse 

 

Dear Jan

 

Thank you for all of that.  I got it to work.  Just one point about the normal module, for anyone else reading this -

 

The normal module, where the subroutines are put, has to be a module within the xlsm workbook not one of the modules, within an xlam, where one's functions code is placed.

 

Re the entering of code in these posts.  There is no </> button in my browser display, neither when using Firefox or Edge.  There is a Formats dropdown, which includes, under the option Inline, <> Code (in red with a pink background).  Clicking on that produces a pink blob, upon which, I suppose, I write code.  I tried that, and all it did, when I previewed my reply, was cause the system to say the post included invalid HTML and it stripped it out.

 

I also tried i. clicking the pink option, then typing the code after the pink blob, which simply sent the pink blob away, and ii. typing the code and then surrounding it with that inline code, but, again, it just got stripped out with the message -

 

Your post has been changed because invalid HTML was found in the message body. The invalid HTML has been removed. Please review the message and submit the message when you are satisfied.

 

Even the copy and pasting of this message, which came up in red, and therefore pasted in red, caused the same error message to appear.

 

I wish I could master this one, but it has stumped me.  If I could be given an exact key stroke by key stroke set of instructions then that would be great but, basically, in my experience, this board makes the posting of code, within a post, just way too difficult; Mr Excel's approach is so much easier.  Dear Jan, please do not take this as directed to you; I just hope one of the board moderators sees this comment and posts such a simple set of instructions and/or changes the way that code is entered, in a post, to a much simpler method, like that found on MrExcel.

 

Thank you, Jan, once again for persevering with me

 

Best

Philip
Bendigo, Victoria
Australia

@PMHunt1955 

Regarding this:

"The normal module, where the subroutines are put, has to be a module within the xlsm workbook not one of the modules, within an xlam, where one's functions code is placed."

Not sure why you say that?

To the insert code button, please see attached screen-shots (taken in Edge under Windows 10).

Insert code button.jpgInsert code dialog.jpg

@Jan Karel Pieterse 

 

Dear Jan

 

Thank you for posting all of that.  I made the comment re where the module needed to be, because I originally put the code in my xlam, where all my functions are, and the 'process' did not work.  It was only when I created a Modules>Module1 within the workbook, which is the subject of this discussion, and placed the code there, in Module1, that the 'process' worked.

 

Thank you for all those screen dumps and annotations re posting code.  Unfortunately my display only includes a little less than half of the icons / options that yours does.  See picture.

 

My_display_in_reply_on_Microsoft_Excel_forum.jpgThe "top" of my forum postings Reply 'window'

I get the same 'top' whether I am in Edge or Firefox, and I am using Windows 10 (automatic update).

 

Best regards

 

Philip

@PMHunt1955 I honestly have no idea what causes your buttons to be less in number than mine.

@Jan Karel Pieterse 

 

Thank you for that.  Hopefully a moderator may see this and suggest why.  Anyway, thank you once again for all your help.

 

Best regards

 

Philip

Related Conversations
Uploading MP3 and WAV Only files
Gordon Charles in Microsoft Stream Forum on
2 Replies
Create folder structures in FILES
Rene Waldboth in Yammer on
3 Replies
Group Chats
Jeff7777 in Microsoft Teams on
5 Replies
Unable to Publish
Kevin Malley in Microsoft Stream Forum on
5 Replies
Arrange Videos in a Playlist
anonymous-user in Microsoft Stream Forum on
8 Replies