Copying Rows Using Target In DoubleClick Macros
Sep 13, 2006
I Have a sheet called "Main" in Which I use a Doubleclick Private function. When the user Double clicks on a row, I want excel to take note of the row number that was clicked, then move to a different sheet and copy the row in the new sheet (Called "Data") with the same row number as the Target row that was Double Clicked.
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Target.Column = 4 Then
Sheets("Data").Select
Sheets("Data").Rows(Target).Copy
Sheets(" Chart Data").Select
Sheets("Chart Data").Rows("2:2").Paste
End If
End Sub
I know The (Target).Copy line is incorrect but I dont know what the correction is.
View 2 Replies
ADVERTISEMENT
Mar 27, 2008
what do people meen when they say target and how is it used from what i can gather its somthing to do with the active cell?
View 9 Replies
View Related
Jul 17, 2009
I have the code below which fills a cell when doubleclicked. I would like to modify this to altenate between 3 different colours on each doubleclick.
View 2 Replies
View Related
Jun 13, 2006
You assisted me in writing a macro to move rows from one worksheet to another based on column criteria. I need a slight improvement to the code, ie it should only delete the rows after moving them if the rows are those that matched the criteria and not those that simply had blank cells for criteria after the rows moved are deleted.
Private Sub CommandButton1_Click()
Dim c As Range
Dim count As Integer
count = 0
If MsgBox("Are you sure you want to move rows to the archive ?", vbOKCancel, _
"Archive") = vbCancel Then Exit Sub
On Error Goto catcher
For Each c In Range("J1:J" & [sheet1].[a65536].End(xlUp).Row)
If c = "yes" Or c = "good" Then
count = count + 1......................
View 2 Replies
View Related
Jun 5, 2014
i have a sheet with name "GrpSum". and i have data in range a6:a500. i want in a range a6:a500 if i DoubleClick in any cell then copy the cell's data as value and paste data in range B4:B53 (after where data is in last row) on another open workbook
View 3 Replies
View Related
Feb 1, 2007
The following code shows the bare bones which illustrate my problem. The routine runs whenever the user enters a string which begins "Frm1=" and contains exactly three commas.
My problem is with the MsgBox which appears if the ErrorHandler is reached. With the following code the MsgBox requires two clicks on OK to dismiss it. If I change Resume to GoTo it requires only one. Is this normal? Is there any way of dismising the MsgBox with one click? ...
View 9 Replies
View Related
Sep 1, 2007
i am needing to issue a dos command in excel? basically i need to send a target link to a file. i cant use a hyper link for several reasons, and this is the only way i know how to go about this.
View 2 Replies
View Related
Aug 8, 2014
I need a code that will copy a list in the same order from different sheets and will paste special and transpose it on the summary sheet.
View 1 Replies
View Related
Mar 12, 2012
I've managed to be able to create a macro to make a copy of a worksheet within excel.
However, when that copy is create all the macros are lost. If it is not possible to copy all the macros that are within the "Original Hours" sheet, I at least need a macro that will take people back to the original hours sheet (we have disabled sheet tabs, so need the macros to navigate through the worksheet).
Code used is below
Private Sub Hours_Click()
Sheets("Original hours").Copy After:=Sheets("Original hours")
ActiveSheet.Name = "Update hours"
ActiveSheet.Unprotect "PASSWORD"
With ActiveSheet.UsedRange
.Value = .Value
Sheets("Update hours").Select
End With
End Sub
View 7 Replies
View Related
Nov 28, 2012
On double clicking a cell, I want to unhide the 10 rows below the target.
VB:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Cancel = True
Range(Target, Target.Offset(10, 0)).EntireRow.Hidden = False
End Sub
I thought this could should do it. But it only seems to want to unhide the target row (obviously unhidden anyway as i'm double-clicking a cell in it).
VB:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Cancel = True
Target.Offset(10, 0).EntireRow.Hidden = False
End Sub
This code unhides only the 10th row below the target.
View 7 Replies
View Related
Sep 12, 2006
I have a data set with rows of data, with a header row along the top. I want to sort my rows of data by column when the cell above the appropriate column is pressed. I know this seems cumbersome - but it fits in with the sheet. The sheet is protected, and we only want the user to be able to sort in this fashion. My problem is, with my code, I get an error when you select a range of two of the header cells. The case selection on the target.column gets confused. How can I check to see if it's just one cell? Is there a property of a range that reflects how many rows or columns it contains? I tried the following (marked with the ' )just from picking out of the pop-up list of properties of the Target range in SelectionChange, but obviously it doesn't work. My original code is the un-'-ed code.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
' If Target.Rows = 1 And Target.Columns = 1 Then
If Target.Row = SortRow Then
Select Case Target.Column
Case PriorityColumn
SortData PriorityColumn
Case JobColumn
SortData JobColumn
Case NotesColumn
SortData NotesColumn
Case SupervisorColumn
SortData SupervisorColumn
Case ShutdownColumn
SortData ShutdownColumn............................
View 2 Replies
View Related
Dec 3, 2012
I have main worksheet (target a) that I am trying to populate data from target(worksheet) b. The data I am trying to get from target b changes every month,(declining balance) based on a new month. So how can I get financial data from different cell each month from "b" into same cell in "a"? (so "A" # would be overwritten in same cell based on new # from "B". I have tried VLookup but can't be doing something correct.
View 2 Replies
View Related
Apr 7, 2014
I have a table of data (say Column1 to Column 5) with multiple rows.
Column 1 to 4 will have the lookup values in multiple rows and Column 5 data should be picked up using vlookup or other lookup function.
I managed to somehow bring all these lookup values in (Column 1 to 4) in a single column in another sheet. I am now trying to use some lookup or other functions to match this single column and pick column 5 data in original sheet. Result i am expecting is lookup value in first column and next to it column 5 value.
It is basically a lookup wherein lookup value is spread over multiple rows and columns and result column is fixed. I tried using vlookup, but lookup value column and column number had to change every time when i moved from column1 to 4.
View 3 Replies
View Related
Jun 4, 2008
I am using a piece of track changes VBA code mentioned on this site, which among other things creates a new column that reports the number of any cell that has been changed (e.g., $K$32). What I would like to do is, next to that cell, report the title of the row in which that cell appears. In other words, if someone changes cell $K$32, for easier reference I'd like others to be able to see that this cell appears in a row titled "New Sales". I'll be happy to clarify with more specifics if need be.
View 2 Replies
View Related
May 25, 2013
I'm not great anyways with VBA Macro.Effectively, here is my issue. I have a spreadsheet which is really badly designed.In one column I have multiple numbers separated by a comma. I need this data separated into new individual rows, but at the same time, copying the data in the other columns in that row to the new row.
Example of what I have:
Test 1 54 email1
Test 2 32, 343, 63, 34 email2
Test 3 4934, 5342 email 3
What I need:
Test 1 54 email1
Test 2 32 email2
Test 2 343 email2
Test 2 63 email2
Test 2 34 email2
Test 3 4934 email3
Test 3 5342 email3
I have have the following code below which paste everything into a new column and into a new row, but the problem I have is that it does not push the other rows data down, nor does it copy the 1st rows data (for that data set) into the new rows created.
Code:
Option Explicit
Sub Macro1()
Dim fromCol As String
Dim toCol As String
Dim fromRow As String
Dim toRow As String
Dim inVal As String
Dim outVal As String
[Code] ........
The amount of rows I have, so this manually (text to column, then transcoding etc) it out of the questions (i have 1000 rows of this!)
View 7 Replies
View Related
Dec 4, 2012
I have few columns, which I need to sum them up at the bottom.
Now the problem is the number of rows will not be same.
the macros code for it?
View 9 Replies
View Related
May 21, 2014
In Sheet1 --> Emp id, Emp Name and Emp dob having some 'p' rows
In Sheet2 --> Emp id, Emp address, Emp Designation and Emp blood group of some 'q' rows
Now, i want in Sheet3 --> Combination of both Sheet1 and Sheet2 data. Note: Emp id in Sheet1 and Sheet2 are same which indicates an unique identifier. I attached a file for your reference..
View 14 Replies
View Related
May 19, 2009
This report spreadsheet is exported from SAP. Since SAP has a limit number of displaying the columns, there are 40 headings (= 40 columns) in the report has been broken down to 4 rows of headings.
How to use macros to move 3 those extra rows to one row and the number still matches each column? I also attatch the file for reference.
View 9 Replies
View Related
Jul 15, 2014
The small attached "Demo2" file indicates my problem. In the "Scorecard" sheet I'm using macros driven from listbox menus to hide or unhide rows on the "Tasks" sheet. It is VITAL that the rows on the "Tasks" sheet not be deleted or have new rows inserted. But, if I Protect them then the list box macros won't function. Is there a macro that will allow these macros to hide or unhide rows without allowing a user to add or delete these rows in the "Tasks" sheet? If possible a simple "global" solution is preferred as I have 100+ If/Then entries to contend with...
Attached File : DEMO2.xlsm
View 1 Replies
View Related
Mar 13, 2009
is to display a set of data based on filtered information.
My Data base:
Company Department Name
A X John
A Y Joe
A X Jane
B Y Bob
C Z Kate
A X Kerri
Based on user selection of Company and Department, I want to be able to display the relavent names.
If user chose Company A, and Department X, I want to be able to display
John
Jane
Kerri
I've used the ROWS, Index, Small combination that works perfectly (Please see sample below). However, since the this software doesn't support the ROWS function, and doesn't support Macros.
View 7 Replies
View Related
Apr 21, 2014
I'm new to Macros and below is my requirement.I need to split my data into multiple rows based on count and the first row should have the value but the other rows should have a value as zero.
Input
Count Value
1 400
2 101
3 300
4 450
Output
Count Value
1 400
2 101
20
3 300
3 0
3 0
4 450
4 0
4 0
4 0
View 4 Replies
View Related
May 21, 2014
So I'm trying my hand at creating VBA buttons and functions that do the following.
Button 1 :
to add a column with every click. The button will create one extra column. So by design there will be at least 1 column. Example if the button is clicked twice it will create 3 columns. I just need a buffer col. (contains no data)
Button 2 :
to delete empty columns leaving only one empty buffer column. That is this button will purge empty columns except the buffer column. OR if ALL the columns are filled, Button2 will create the buffer column.
Eg. I click Button 1 three times. It creates four columns. I only fill two columns. When Button 2 is clicked it will delete all the empty colums except the buffer column. OR I fill in all four columns, there is no buffer column, when I click Button2 it will insert the buffer col.
Button 3 :
to add a row with every click. The button will create one extra row. So by design there will be at least 1 row. Example if the button is clicked twice it will create 3 rows. I just need a buffer row. (contains no data)
Button 4 :
to delete empty row leaving only one empty buffer row. That is this button will purge empty row except the buffer row. OR if ALL the columns are filled, Button4 will create the buffer column.
Eg. I click Button 3 three times. It creates four rows. I only fill two rows. When Button 4 is clicked it will delete all the empty rows except the buffer rows. OR I fill in all four rows, there is no buffer rows, when I click Button4 it will insert the buffer row.
In the sample file there are six columns filled with data. The 7th col is empty(the buffer column). The column after that calculates the average of data in filled columns. There are eight rows with data and the ninth row is the empty buffer row.
The "add" buttons must be able copy the format/formula of the column/rows BEFORE the buffer colums/rows and insert it before the buffer column/row.
View 3 Replies
View Related
Mar 11, 2014
I have a sheet with macros that allows users to fill in data from columns F10 to O10 from row 10 to 54.
Column P will then make some computations based on the inputs from col F to O.
Row 55 will also make some computation based on inputs from row 10 to 54.
How to I modify the code below to allow users to either add/delete columns and rows such that it does not fowl up the computations?
The computation does not have to be at column P or at row 55, they can be dynamic and change depending on how many rows and columns the users delete/add.
A little background on what the code does. From Column F to O, the code UNLOCKS the columns only if user inputs date in Cell 3 of that particular column.
Example. Column F is locked from F10 to infinity at the start. Only when user inputs date into F3 does the cells F10:F54 is unlocked for user to input data.
This goes on until column O. I want users to be able to add more columns, or delete ones they don't need.
View 2 Replies
View Related
Apr 30, 2009
I have a macro which I have been successfully using for a while and it's served me well. But now I have far too much data on my source file (55-60k rows) and I only need data the data if Column C is "AB". I'm the first to admit that I know nothing about macros.
If anyone can tell me how to make this only copy the rows where Coulumn C is "AB".
Do While fn ""
If fn ThisWorkbook.Name Then
With Workbooks.Open(myDir & fn)
With .Sheets("3-Queues by Agent").Range("A1:R60000")
ThisWorkbook.Sheets(5).Range("a" & Rows.Count).End(xlUp)(2) _
.Resize(.Rows.Count, .Columns.Count).Value = .Value
End With
.Close False
End With
End If
View 9 Replies
View Related
May 7, 2012
Each week I run a report that produces over 2,000 rows. I have to manually go through and delete things, by the time I am done, there may only be 320 rows left. I would apply a recorded macro, but the report is not consistent each week. There may be more or fewer rows depending on the week.
I would like to be able to run a macro that looks in column B for a specific value and if it contains that specific value, I would like the cells to the right of it to have their contents cleared.
Next, in column C, I have...
Employee2's Name
Employee2's Number
SPACE
[Code]....
I would like to be able to delete the rows, starting from Employee 2 to just before the second SUB TOTAL.
So, all I would have left in column C is
SUB TOTAL
SPACE
View 9 Replies
View Related
May 12, 2014
I have 2 columns of data E and F. Column E has 11 different words that randomly repeat, Column F has 10 years of dates, about 1,000 entries (10/11/12 format). Both columns values come from formulas.
I am trying to copy cells E & F to columns K & L starting in row 2 only if there is is data in column E (one of the 11 words) and skipping all others rows. Both the E & F values of tthe row must be copied together, i.e if text is in E45, then copy E45 and F45 into column K and L starting with K2 & L2. This is a task which will be repeated multiple times as data is replaced in columns A-D.
View 4 Replies
View Related
Oct 23, 2007
I have to copy the formatting from "rows G&H" for 40,000+ lines. Is there an easier way than doing the formatting then highlighting the first two cells (G4 and H4) then dragging the bottom right hand corner down 40,000 lines?
View 5 Replies
View Related
Apr 25, 2009
I have a spreadsheet (see attached) that has city names, accessories sku number and quantity sold for each week. I run this report every week and when the spreadsheet has empty rows which I delete, but there are some rows that also have partial data that can be deleted. Anyway, I would like to copy name of first store (los Angeles) in this sample and copy down till the next city comes up (San Diego) and do the same all the way down. I have total of 20 stores and I wondering if you guys know of a formula or vba code that could help me with this.
View 9 Replies
View Related
Apr 16, 2013
For example, I have an excel worksheet which has a main "master" list that has all of the cars that are sold along with the name of the salesperson who sold it all the way to the right (Column 6)
What i am trying to accomplish:
I would like excel to automatically take all of the rows which have the same salesperson name in column six and sort them into separate sheets, but i would also like these rows to automatically update if information is changed in them or if they are deleted on either the salespersons sheet or the master sheet.
View 2 Replies
View Related
Aug 8, 2007
How do I go about copying rows starting at A1 and counting down until there is a blank row in VBA?
I.e.
Row 1 - value
Row 2 - value
Etc etc
Then Row 13 is blank
I just want to copy all the data above the blank row, which I will then paste on another xls?
View 9 Replies
View Related