Ask Question Forum:
Model Library:2025-02-08:A.I. model is online auto reply
C
O
M
P
U
T
E
R
2
8
Show
#
ASK
RECENT
←
- Underline
- Bold
- Italic
- Indent
- Step
- Bullet
- Quote
- Cut
- Copy
- Paste
- Table
- Spelling
- Find & Replace
- Undo
- Redo
- Link
- Attach
- Clear
- Code
Below area will not be traslated by Google,you can input code or other languages
Hint:If find spelling error, You need to correct it,1 by 1 or ignore it (code area won't be checked).
X-position of the mouse cursor
Y-position of the mouse cursor
Y-position of the mouse cursor
Testcursor
caretPos
Attachment:===
Asked by ambientsbs
at 2024-07-30 16:06:41
Point:500 Replies:2 POST_ID:829173USER_ID:12065
Topic:
VB Script;Microsoft Visual Basic.Net;Miscellaneous Programming
Hello Experts!
I have two VBA functions in an Excel file that I'm using to perform two separate operations. They look like this:
I have two VBA functions in an Excel file that I'm using to perform two separate operations. They look like this:
Public Sub Cell2Cell(ByRef Source_Range As Range, ByRef Target_Range As Range)Dim i As Integeri = 1For Each c In Source_Range.Cells If IsNumeric(c.Value) Then Target_Range.Cells(i) = c.Value Else Target_Range.Cells(i) = "" End If i = i + 1NextEnd SubPublic Sub Matching_Cell2Cell(ByRef Source_Range As Range, ByRef Crit_Range As Range, ByRef Copy_Range As Range) Source_Range.AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Crit_Range, CopyToRange:=Copy_Range, Unique:=FalseEnd Sub 1:2:3:4:5:6:7:8:9:10:11:12:13:14:15:16:17:18:19:20:21:22:23:24:
I use the first function to copy cells from one cell range to another, but only cells that have a numeric value. In this scenario, I only have one row of cells in a range that I'm copying. What I'm looking to do is combine these two functions into one, where I can basically filter multiple rows, based on a range that defines my filter, and then copy ONLY numeric values to another range where the cells are in a different orientation. I know in advance that my filter would always yield only one row of results.
To give an example, I want to take a range of data like A1:F200, filter that list down to one row based on a filter that would be looking at the data in column A. After my range has been filtered and I have one row of data that sits horizontally from say cells A9:F9 in "Sheet 1" I would like to copy only the numeric data to a range in "Sheet 2" to cells I9:I14.
Can someone please tell me how I would do this? Thank you!
Author: ambientsbs replied at 2024-07-31 15:36:59
Hi Duncan,
Thank you for the response but, unfortunately, I don't think that "record a macro" is the response that I'm looking for. : ) I don't mean to sound rude, so please don't take it that way. It just doesn't seem possible to record what I'm looking to do, where I would change a dropdown that would affect how my rows are filtered and then copy only numeric data to another cell range.
Would it be more helpful for me to attach an Excel document that shows in more depth what I'm looking to do? I need someone to simply tell me how to do what I'm looking to do with code. Thanks again!
Thank you for the response but, unfortunately, I don't think that "record a macro" is the response that I'm looking for. : ) I don't mean to sound rude, so please don't take it that way. It just doesn't seem possible to record what I'm looking to do, where I would change a dropdown that would affect how my rows are filtered and then copy only numeric data to another cell range.
Would it be more helpful for me to attach an Excel document that shows in more depth what I'm looking to do? I need someone to simply tell me how to do what I'm looking to do with code. Thanks again!
Expert: duncanb7 replied at 2024-07-30 19:40:57
Since your need can be done on Excel cell menu tab or click function, so you can do it by Macro Recording.
Did you use "Macro recording" , click tools-Macro->Record macro, and choose saving maco location,
and then click or do any action on Excel cell , for example, drag the range cell and click Excel
tab for autofit tab. Afterwards, all action will be translated into VBA code and save it on the macro
There is MR tutorial at this site ,
http://www.youtube.com/watch?v=nvWpFdo7EO0
If it is not done, please send us your example excel file with data cell examples included with VBA code that will let other experts to understand your quesion easier.
Duncan
Did you use "Macro recording" , click tools-Macro->Record macro, and choose saving maco location,
and then click or do any action on Excel cell , for example, drag the range cell and click Excel
tab for autofit tab. Afterwards, all action will be translated into VBA code and save it on the macro
There is MR tutorial at this site ,
http://www.youtube.com/watch?v=nvWpFdo7EO0
If it is not done, please send us your example excel file with data cell examples included with VBA code that will let other experts to understand your quesion easier.
Duncan