excel-vba

VBA - copy and paste between sheets not pasting in the right location

大城市里の小女人 提交于 2020-06-17 09:32:22
问题 I am using VBA to paste some data from one sheet to another. The first button press works as it is designed to (updating a row i45 etc). The second button press was meant to paste data to the next row (i46 etc..) as it is empty row) but it actually updates the row i21 any subsequent presses just update i21 overwriting. Can you please check what I have done wrong. Private Sub CommandButton1_Click() Application.ScreenUpdating = False Dim copySheet As Worksheet Dim pasteSheet As Worksheet Set

Disable copy(ctrl+c), paste(ctrl+v),cut(ctrl+x) in excel

痞子三分冷 提交于 2020-06-17 08:23:17
问题 I have developed the vsto template in C# in which,i have added data validation for many fields in the excel sheet.If the user copy paste the content, those validations rules are overwrites and does not work. how can i restrict user to copy,paste,cut.**Is there any **other way to overcome this problem? 回答1: Have you tried protecting the workbook ? Two ways to do the same 1.)manually 2.)programatically 回答2: Following code should intercept Ctrl+V and effectively disable it 1.To disable the Paste

Disable copy(ctrl+c), paste(ctrl+v),cut(ctrl+x) in excel

烈酒焚心 提交于 2020-06-17 08:23:07
问题 I have developed the vsto template in C# in which,i have added data validation for many fields in the excel sheet.If the user copy paste the content, those validations rules are overwrites and does not work. how can i restrict user to copy,paste,cut.**Is there any **other way to overcome this problem? 回答1: Have you tried protecting the workbook ? Two ways to do the same 1.)manually 2.)programatically 回答2: Following code should intercept Ctrl+V and effectively disable it 1.To disable the Paste

Excel VBA addPicture by path to image

浪子不回头ぞ 提交于 2020-06-17 08:08:01
问题 I've written an VBA Macro on windows. This Macro adds pictures into my excel sheet based on the value of a cell e.g. 'image.png'. These images are located in the same directory as my Excel workbook. VBA will get the path to the workbook and use it to find the image specified in the cell. This works on windows, however it does not work on mac. The macro returns an error (1004) saying it can't find the specified file. Sub InsertImage() Dim useless As Double Dim clTop As Double For Each c In

Excel VBA addPicture by path to image

随声附和 提交于 2020-06-17 08:05:19
问题 I've written an VBA Macro on windows. This Macro adds pictures into my excel sheet based on the value of a cell e.g. 'image.png'. These images are located in the same directory as my Excel workbook. VBA will get the path to the workbook and use it to find the image specified in the cell. This works on windows, however it does not work on mac. The macro returns an error (1004) saying it can't find the specified file. Sub InsertImage() Dim useless As Double Dim clTop As Double For Each c In

How to get filtered data as rowsource of multicolumn listbox?

南笙酒味 提交于 2020-06-17 08:01:12
问题 I have data in Sheet2 as like below. Actual Data Then I manually apply filer to those data which looks like... Filtered Data I have a user form (UserForm1) and a list box ( ListBox1 ) in the form. Also have a command button cmdFilteredData . So, I want to fill the listbox with filtered data only. I make below codes but it gives Type mismatch error. Private Sub cmdFilteredData_Click() Dim FilteredRange As Range Set FilteredRange = Sheet2.Range("A1:C5").Rows.SpecialCells(xlCellTypeVisible) With

VBA Excel input data into already opened ie window

空扰寡人 提交于 2020-06-17 07:57:09
问题 I have here a very simple example when pressing button1 will open a new ie window and into google search inputs "cheap plastic windows". What I want to do is when I press button2 the text in google search (already opened ie window) changes to "cheap plastic doors". I have been trying to do it for 2 days but can not seem to find how to. Would appreciate if you could help with a working example. Thank you Private Sub CommandButton1_Click() Set objIE = CreateObject("InternetExplorer.Application"

VBA- Using RefEdit for copying range between workbooks

你说的曾经没有我的故事 提交于 2020-06-17 07:18:29
问题 I wanted to copy some not continous ranges from several workbook/ worksheets to a specific sheet. I am using a userform and RefEdit control on that. But the Excel freezs each time I am calling the form and addressing the ranges! I can't do anything except End Excel! Here is my Code. Private Sub CommandButton1_Click() Dim rng As Range Set rng = Range(Me.RefEdit1.Value) rng.Copy ThisWorkbook.Sheets("Transfer").Range("a1").PasteSpecial xlPasteValues End Sub Private Sub UserForm_Activate() For

VBA- Using RefEdit for copying range between workbooks

喜夏-厌秋 提交于 2020-06-17 07:18:07
问题 I wanted to copy some not continous ranges from several workbook/ worksheets to a specific sheet. I am using a userform and RefEdit control on that. But the Excel freezs each time I am calling the form and addressing the ranges! I can't do anything except End Excel! Here is my Code. Private Sub CommandButton1_Click() Dim rng As Range Set rng = Range(Me.RefEdit1.Value) rng.Copy ThisWorkbook.Sheets("Transfer").Range("a1").PasteSpecial xlPasteValues End Sub Private Sub UserForm_Activate() For

Copying data from specific cells across multiple workbooks to 'master workbook' programmatically

和自甴很熟 提交于 2020-06-17 05:20:09
问题 I have two questions but first a bit of background... I have a number of workbooks each containing a different number of worksheets all saved in the same folder. Each worksheet except the first has an invoice from which I need data from specific cells copied on to the master sheet. The Master sheet has 5 columns which will be populated with the information from the same 5 cells on each sheet on the following row. Invoice Sheets Cell Master Sheet Row E9 A D18 B D22 C E11 D F27 E . Sub